Dali 3D User Interface Engine
combined-update-render-controller-debug.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H__
2 #define __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H__
3 
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
23 
24 namespace Dali
25 {
26 
27 namespace Internal
28 {
29 
30 namespace Adaptor
31 {
32 
33 namespace
34 {
35 // Uncomment next line for FULL logging of the ThreadSynchronization class in release mode
36 //#define RELEASE_BUILD_LOGGING
37 
38 #ifdef DEBUG_ENABLED
39 
40 #define ENABLE_LOG_IN_COLOR
41 #define ENABLE_COUNTER_LOGGING
42 #define ENABLE_UPDATE_RENDER_THREAD_LOGGING
43 #define ENABLE_EVENT_LOGGING
44 
45 #define DEBUG_LEVEL_COUNTER Debug::Verbose
46 #define DEBUG_LEVEL_UPDATE_RENDER Debug::General
47 #define DEBUG_LEVEL_EVENT Debug::Concise
48 
49 Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_THREAD_SYNC" );
50 
51 #define LOG_THREAD_SYNC(level, color, format, args...) \
52  DALI_LOG_INFO( gLogFilter, level, "%s" format "%s\n", color, ## args, COLOR_CLEAR )
53 
54 #define LOG_THREAD_SYNC_TRACE(color) \
55  Dali::Integration::Log::TraceObj debugTraceObj( gLogFilter, "%s%s%s", color, __FUNCTION__, COLOR_CLEAR ); \
56  if( ! gLogFilter->IsTraceEnabled() ) { LOG_THREAD_SYNC( Debug::Concise, color, "%s", __FUNCTION__ ); }
57 
58 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, args...) \
59  Dali::Integration::Log::TraceObj debugTraceObj( gLogFilter, "%s%s: " format "%s", color, __FUNCTION__, ## args, COLOR_CLEAR ); \
60  if( ! gLogFilter->IsTraceEnabled() ) { LOG_THREAD_SYNC( Debug::Concise, color, "%s: " format, __FUNCTION__, ## args ); }
61 
62 #elif defined( RELEASE_BUILD_LOGGING )
63 
64 #define ENABLE_LOG_IN_COLOR
65 #define ENABLE_COUNTER_LOGGING
66 #define ENABLE_UPDATE_RENDER_THREAD_LOGGING
67 #define ENABLE_EVENT_LOGGING
68 
69 #define DEBUG_LEVEL_COUNTER 0
70 #define DEBUG_LEVEL_UPDATE_RENDER 0
71 #define DEBUG_LEVEL_EVENT 0
72 
73 #define LOG_THREAD_SYNC(level, color, format, args...) \
74  Dali::Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo, "%s" format "%s\n", color, ## args, COLOR_CLEAR )
75 
76 #define LOG_THREAD_SYNC_TRACE(color) \
77  Dali::Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo, "%s%s%s\n", color, __FUNCTION__, COLOR_CLEAR )
78 
79 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, args...) \
80  Dali::Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo, "%s%s: " format "%s\n", color, __FUNCTION__, ## args, COLOR_CLEAR )
81 
82 #else
83 
84 #define LOG_THREAD_SYNC(level, color, format, args...)
85 #define LOG_THREAD_SYNC_TRACE(color)
86 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, args...)
87 
88 #endif // DEBUG_ENABLED
89 
90 #ifdef ENABLE_LOG_IN_COLOR
91 #define COLOR_YELLOW "\033[33m"
92 #define COLOR_LIGHT_RED "\033[91m"
93 #define COLOR_LIGHT_YELLOW "\033[93m"
94 #define COLOR_WHITE "\033[97m"
95 #define COLOR_CLEAR "\033[0m"
96 #else
97 #define COLOR_YELLOW
98 #define COLOR_LIGHT_RED
99 #define COLOR_LIGHT_YELLOW
100 #define COLOR_WHITE
101 #define COLOR_CLEAR
102 #endif
103 
104 #ifdef ENABLE_COUNTER_LOGGING
105 #define LOG_COUNTER_EVENT(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_COUNTER, COLOR_LIGHT_RED, "%s: " format, __FUNCTION__, ## args)
106 #define LOG_COUNTER_UPDATE_RENDER(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_COUNTER, COLOR_LIGHT_YELLOW, "%s: " format, __FUNCTION__, ## args)
107 #else
108 #define LOG_COUNTER_EVENT(format, args...)
109 #define LOG_COUNTER_UPDATE_RENDER(format, args...)
110 #endif
111 
112 #ifdef ENABLE_UPDATE_RENDER_THREAD_LOGGING
113 #define LOG_UPDATE_RENDER(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_UPDATE_RENDER, COLOR_YELLOW, "%s: " format, __FUNCTION__, ## args)
114 #define LOG_UPDATE_RENDER_TRACE LOG_THREAD_SYNC_TRACE(COLOR_YELLOW)
115 #define LOG_UPDATE_RENDER_TRACE_FMT(format, args...) LOG_THREAD_SYNC_TRACE_FMT(COLOR_YELLOW, format, ## args)
116 #else
117 #define LOG_UPDATE_RENDER(format, args...)
118 #define LOG_UPDATE_RENDER_TRACE
119 #define LOG_UPDATE_RENDER_TRACE_FMT(format, args...)
120 #endif
121 
122 #ifdef ENABLE_EVENT_LOGGING
123 #define LOG_EVENT(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_EVENT, COLOR_WHITE, "%s: " format, __FUNCTION__, ## args)
124 #define LOG_EVENT_TRACE LOG_THREAD_SYNC_TRACE(COLOR_WHITE)
125 #define LOG_EVENT_TRACE_FMT(format, args...) LOG_THREAD_SYNC_TRACE_FMT(COLOR_WHITE, format, ## args)
126 #else
127 #define LOG_EVENT(format, args...)
128 #define LOG_EVENT_TRACE
129 #define LOG_EVENT_TRACE_FMT(format, args...)
130 #endif
131 
132 } // unnamed namespace
133 
134 } // namespace Adaptor
135 
136 } // namespace Internal
137 
138 } // namespace Dali
139 
140 #endif // __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H__
Dali Docs Home
Read more about Dali