Advertisement
arter97

Untitled

Apr 2nd, 2017
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.05 KB | None | 0 0
  1. commit c12f28298d3ac4faf301e93da301aa0fdcb402e6
  2. Author: Park Ju Hyung <qkrwngud825@gmail.com>
  3. Date:   Mon Apr 3 02:11:40 2017 +0900
  4.  
  5.     Log debugging messages only when requested
  6.    
  7.     Change-Id: If019e69f6530363d8870323c9e2e843b66b42a21
  8.     Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
  9.  
  10. diff --git a/common.mk b/common.mk
  11. index c2a6cac6..a13a34c1 100644
  12. --- a/common.mk
  13. +++ b/common.mk
  14. @@ -30,9 +30,19 @@ else
  15.      LOCAL_CLANG := true
  16.  endif
  17.  
  18. +#Debugging mode
  19. +debug := false
  20. +
  21.  #Common C flags
  22. -common_flags += -DDEBUG_CALC_FPS -Wno-missing-field-initializers
  23. +common_flags += -Wno-missing-field-initializers
  24.  common_flags += -Wconversion -Wall -Werror -std=c++11
  25. +
  26. +ifeq ($(debug), true)
  27. +    common_flags += -DDEBUG=1 -DDEBUG_CALC_FPS
  28. +else
  29. +    common_flags += -Wno-unused-parameter -Wno-unused-variable
  30. +endif
  31. +
  32.  ifneq ($(TARGET_USES_GRALLOC1), true)
  33.      common_flags += -isystem $(display_top)/libgralloc
  34.  else
  35. diff --git a/hdmi_cec/QHDMIClient.cpp b/hdmi_cec/QHDMIClient.cpp
  36. index 2b2b1e6f..6620768f 100644
  37. --- a/hdmi_cec/QHDMIClient.cpp
  38. +++ b/hdmi_cec/QHDMIClient.cpp
  39. @@ -27,7 +27,10 @@
  40.  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  41.  */
  42.  
  43. +#ifndef DEBUG
  44.  #define DEBUG 0
  45. +#endif
  46. +
  47.  #include <QServiceUtils.h>
  48.  #include "QHDMIClient.h"
  49.  
  50. diff --git a/hdmi_cec/qhdmi_cec.cpp b/hdmi_cec/qhdmi_cec.cpp
  51. index f84cf809..6299691f 100644
  52. --- a/hdmi_cec/qhdmi_cec.cpp
  53. +++ b/hdmi_cec/qhdmi_cec.cpp
  54. @@ -27,7 +27,10 @@
  55.  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  56.  */
  57.  
  58. +#ifndef DEBUG
  59.  #define DEBUG 0
  60. +#endif
  61. +
  62.  #define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
  63.  #include <cstdlib>
  64.  #include <cutils/log.h>
  65. diff --git a/libgralloc/ionalloc.cpp b/libgralloc/ionalloc.cpp
  66. index 96e0e3ed..4e89cce3 100644
  67. --- a/libgralloc/ionalloc.cpp
  68. +++ b/libgralloc/ionalloc.cpp
  69. @@ -27,7 +27,10 @@
  70.   * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  71.   */
  72.  
  73. +#ifndef DEBUG
  74.  #define DEBUG 0
  75. +#endif
  76. +
  77.  #define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
  78.  #include <sys/ioctl.h>
  79.  #include <sys/mman.h>
  80. diff --git a/libgralloc1/gr_ion_alloc.cpp b/libgralloc1/gr_ion_alloc.cpp
  81. index ca93a632..1830a073 100644
  82. --- a/libgralloc1/gr_ion_alloc.cpp
  83. +++ b/libgralloc1/gr_ion_alloc.cpp
  84. @@ -27,7 +27,10 @@
  85.   * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  86.   */
  87.  
  88. +#ifndef DEBUG
  89.  #define DEBUG 0
  90. +#endif
  91. +
  92.  #define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
  93.  #include <sys/ioctl.h>
  94.  #include <sys/mman.h>
  95. diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
  96. index e35ddf32..440df309 100644
  97. --- a/sdm/include/utils/debug.h
  98. +++ b/sdm/include/utils/debug.h
  99. @@ -35,8 +35,20 @@
  100.  #include <core/debug_interface.h>
  101.  #include <core/display_interface.h>
  102.  
  103. -#define DLOG(tag, method, format, ...) Debug::Get()->method(tag, __CLASS__ "::%s: " format, \
  104. -                                                            __FUNCTION__, ##__VA_ARGS__)
  105. +#ifdef DEBUG
  106. +  #define DLOG(tag, method, format, ...) Debug::Get()->method(tag, __CLASS__ "::%s: " format, \
  107. +                                                              __FUNCTION__, ##__VA_ARGS__)
  108. +
  109. +  #define DTRACE_BEGIN(custom_string) Debug::Get()->BeginTrace(__CLASS__, __FUNCTION__, custom_string)
  110. +  #define DTRACE_END() Debug::Get()->EndTrace()
  111. +  #define DTRACE_SCOPED() ScopeTracer <Debug> scope_tracer(__CLASS__, __FUNCTION__)
  112. +#else
  113. +  #define DLOG(...) {}
  114. +
  115. +  #define DTRACE_BEGIN(...) {}
  116. +  #define DTRACE_END(...) {}
  117. +  #define DTRACE_SCOPED(...) {}
  118. +#endif
  119.  
  120.  #define DLOGE_IF(tag, format, ...) DLOG(tag, Error, format, ##__VA_ARGS__)
  121.  #define DLOGW_IF(tag, format, ...) DLOG(tag, Warning, format, ##__VA_ARGS__)
  122. @@ -50,10 +62,6 @@
  123.  #define DLOGI(format, ...) DLOGI_IF(kTagNone, format, ##__VA_ARGS__)
  124.  #define DLOGV(format, ...) DLOGV_IF(kTagNone, format, ##__VA_ARGS__)
  125.  
  126. -#define DTRACE_BEGIN(custom_string) Debug::Get()->BeginTrace(__CLASS__, __FUNCTION__, custom_string)
  127. -#define DTRACE_END() Debug::Get()->EndTrace()
  128. -#define DTRACE_SCOPED() ScopeTracer <Debug> scope_tracer(__CLASS__, __FUNCTION__)
  129. -
  130.  namespace sdm {
  131.  
  132.  class Debug {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement