1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _UI_GRAPHIC_LOG_H 18 #define _UI_GRAPHIC_LOG_H 19 20 #include <utils/Singleton.h> 21 #include <cutils/compiler.h> 22 23 namespace android { 24 25 class GraphicLog : public Singleton<GraphicLog> 26 { 27 int32_t mEnabled; 28 static void logImpl(int32_t tag, int32_t buffer); 29 static void logImpl(int32_t tag, int32_t identity, int32_t buffer); 30 31 public: 32 enum { 33 SF_APP_DEQUEUE_BEFORE = 60100, 34 SF_APP_DEQUEUE_AFTER = 60101, 35 SF_APP_LOCK_BEFORE = 60102, 36 SF_APP_LOCK_AFTER = 60103, 37 SF_APP_QUEUE = 60104, 38 39 SF_REPAINT = 60105, 40 SF_COMPOSITION_COMPLETE = 60106, 41 SF_UNLOCK_CLIENTS = 60107, 42 SF_SWAP_BUFFERS = 60108, 43 SF_REPAINT_DONE = 60109, 44 45 SF_FB_POST_BEFORE = 60110, 46 SF_FB_POST_AFTER = 60111, 47 SF_FB_DEQUEUE_BEFORE = 60112, 48 SF_FB_DEQUEUE_AFTER = 60113, 49 SF_FB_LOCK_BEFORE = 60114, 50 SF_FB_LOCK_AFTER = 60115, 51 }; 52 53 inline void log(int32_t tag, int32_t buffer) { 54 if (CC_UNLIKELY(mEnabled)) 55 logImpl(tag, buffer); 56 } 57 inline void log(int32_t tag, int32_t identity, int32_t buffer) { 58 if (CC_UNLIKELY(mEnabled)) 59 logImpl(tag, identity, buffer); 60 } 61 62 GraphicLog(); 63 64 void setEnabled(bool enable); 65 }; 66 67 } 68 69 #endif // _UI_GRAPHIC_LOG_H 70 71