Profiling disabled for other configurations
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 8 Nov 2012 11:37:59 +0000 (12:37 +0100)
committerGerrit Code Review <gerrit2@kim11>
Mon, 19 Nov 2012 09:05:34 +0000 (18:05 +0900)
[Issue#] N/A
[Bug] Profiling library was compiled and used regardless of the build
configuration. Logs should be disabled in configurations other than Debug.
[Problem] N/A
[Cause] Incorrect cmake configuration.
[Solution] Compilation is triggered only in Profiling build configuration. Logs
allowed only in Debug mode.

[Verification]
1.Compile wrt with build_type set to Profiling and any other (Release, Debug).
Both should succeed.
2.For both configurations run rpm -qlp <wrt.rpm> | grep profiling. Only in case
of Profiling the library should be present.
3.Run any widget. It should be displayed properly in both cases.
4.Run profiling scripts. In case of profiling they should produce graphs. It
should fail (freeze) in other configurations.
5.Check compilation output. Logs should be enabled only in Debug mode

Change-Id: Ia60d609433e1896750f43a3508ca343b7e86695a

CMakeLists.txt
src/CMakeLists.txt
src/profiling/profiling_util.h

index 9d14f21..3db18e0 100644 (file)
@@ -42,12 +42,23 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
 
 OPTION(DPL_LOG "DPL logs status" ON)
 
-IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
-    MESSAGE(STATUS "Logging enabled for DPL")
+# logs can be only enabled in debug mode
+IF(CMAKE_BUILD_TYPE MATCHES "Debug" AND DPL_LOG)
     ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
-ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
+    MESSAGE(STATUS "Logging enabled for DPL")
+ELSE(CMAKE_BUILD_TYPE MATCHES "Debug" AND DPL_LOG)
     MESSAGE(STATUS "Logging disabled for DPL")
-ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
+ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug" AND DPL_LOG)
+
+MESSAGE(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+OPTION(PROFILING "Profiling status" OFF)
+IF(CMAKE_BUILD_TYPE MATCHES "Profiling")
+    MESSAGE(STATUS "PROFILING: ENABLED")
+    ADD_DEFINITIONS("-DPROFILING_ENABLED")
+    SET(PROFILING ON)
+ELSE(CMAKE_BUILD_TYPE MATCHES "Profiling")
+    MESSAGE(STATUS "PROFILING: DISABLED")
+ENDIF(CMAKE_BUILD_TYPE MATCHES "Profiling")
 
 # Compiler flags
 SET(CMAKE_C_FLAGS_PROFILING    "-O2")
@@ -117,16 +128,9 @@ SET(TARGET_VIEW_MODULE_LIB "wrt-view-module")
 SET(TARGET_CORE_MODULE_LIB "wrt-core-module")
 SET(TARGET_BUNDLES_LIB "wrt-wk2-bundle")
 
-# PROFILING
-# need to check build with OFF
-OPTION(PROFILING "Profiling enabled" ON)
+SET(PROF_LIB "")
 IF(PROFILING)
-    MESSAGE(STATUS "PROFILING: ENABLED")
-    ADD_DEFINITIONS("-DPROFILING_ENABLED")
     SET(PROF_LIB ${TARGET_PROFILING_LIB})
-ELSE(PROFILING)
-    MESSAGE(STATUS "PROFILING: DISABLED")
-    SET(PROF_LIB "")
 ENDIF(PROFILING)
 
 INSTALL(FILES
index 13abe28..2bdb064 100755 (executable)
@@ -141,4 +141,6 @@ ADD_SUBDIRECTORY(api_new)
 ADD_SUBDIRECTORY(wrt-client)
 ADD_SUBDIRECTORY(wrt-launcher)
 ADD_SUBDIRECTORY(plugin-service)
-ADD_SUBDIRECTORY(profiling)
+IF(PROFILING)
+    ADD_SUBDIRECTORY(profiling)
+ENDIF(PROFILING)
index 2e5cc89..64b909a 100644 (file)
@@ -48,6 +48,8 @@ void AddStdoutProfilingMeasurment(const char* name, bool start);
 #else //PROFILING_ENABLED
 
 #define ADD_PROFILING_POINT(name, ...) (void)1
+#define LOG_PROFILE_START(x) (void)1
+#define LOG_PROFILE_STOP(x) (void)1
 
 #endif //PROFILING_ENABLED