Change profiling build
authorPrzemyslaw Ciezkowski <p.ciezkowski@samsung.com>
Wed, 24 Oct 2012 07:22:43 +0000 (09:22 +0200)
committerJihoon Chung <jihoon.chung@samsung.com>
Tue, 30 Oct 2012 08:18:04 +0000 (17:18 +0900)
[Issue#] LINUXNGWAP-444
[Feature] Change build parameters for profiling: -O2 optimization, disable debug symbols generation,
disable logs (change WebProcess profiling), disable gprof symbols generation.
Also profiling script was fixed after last changes in wrt-launcher.
[Cause] N/A
[Solution] Changed and fixed profiling. Updated wrt-preloader.
[Verification] Build repository with build_type=profiling. Run any widget,
check if wrt-client logs are disabled. Run profiling scripts.

Change-Id: I9870546ef472e763c548f77eb1b0d3722a48bf3a

CMakeLists.txt
src/profiling/profiling_util.cpp
src/profiling/profiling_util.h
src/profiling/script/profiling-target-part.pl
src/profiling/script/utils/wrt-preloader
src/view/webkit/bundles/CMakeLists.txt

index bee5b1e..6f25f53 100644 (file)
@@ -28,15 +28,6 @@ PROJECT(wrt)
 
 INCLUDE(FindPkgConfig)
 
-# Options
-OPTION(DPL_LOG "DPL logs status" ON)
-IF(DPL_LOG)
-    MESSAGE(STATUS "Logging enabled for DPL")
-    ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
-ELSE(DPL_LOG)
-    MESSAGE(STATUS "Logging disabled for DPL")
-ENDIF(DPL_LOG)
-
 STRING(REGEX MATCH "([^.]*)" PROJECT_API_VERSION "${PROJECT_VERSION}")
 ADD_DEFINITIONS("-DPROJECT_API_VERSION=\"$(PROJECT_API_VERSION)\"")
 MESSAGE(STATUS "Version from changelog: ${PROJECT_VERSION}")
@@ -49,9 +40,18 @@ IF(NOT CMAKE_BUILD_TYPE)
     SET(CMAKE_BUILD_TYPE "Release")
 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")
+    ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
+ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
+    MESSAGE(STATUS "Logging disabled for DPL")
+ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
+
 # Compiler flags
-SET(CMAKE_C_FLAGS_PROFILING    "-O0 -g -pg")
-SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -std=c++0x -g -pg")
+SET(CMAKE_C_FLAGS_PROFILING    "-O2")
+SET(CMAKE_CXX_FLAGS_PROFILING  "-O2 -std=c++0x")
 SET(CMAKE_C_FLAGS_DEBUG        "-O0 -g")
 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -std=c++0x -g")
 SET(CMAKE_C_FLAGS_RELEASE      "-O2 -g")
index bba7a7c..0207711 100644 (file)
@@ -124,8 +124,30 @@ int initialize()
     AddProfilingMeasurment("Profiling_Started");
     return 1;
 }
+
+std::string GetFormattedTime()
+{
+    timeval tv;
+    tm localNowTime;
+
+    gettimeofday(&tv, NULL);
+    localtime_r(&tv.tv_sec, &localNowTime);
+
+    char format[64];
+    snprintf(format, sizeof(format), "%02i:%02i:%02i.%03i", localNowTime.tm_hour, localNowTime.tm_min, localNowTime.tm_sec, static_cast<int>(tv.tv_usec / 1000));
+    return format;
+}
+
 } // namespace anonymous
 
+void AddStdoutProfilingMeasurment(const char* name, bool start)
+{
+    std::ostringstream output;
+    output << "[" << GetFormattedTime()  << "] [](): " << name << " ";
+    output << (start ? "profiling##start" : "profiling##stop");
+    fprintf(stdout, "%s\n", output.str().c_str());
+}
+
 extern "C"
 void AddProfilingMeasurment(const char* name,
         const char* prefix,
index 5024c74..2e5cc89 100644 (file)
@@ -41,11 +41,10 @@ void AddProfilingMeasurment(const char* name,
                                                                        desc)
 #endif //__cplusplus
 
-// profiling script additional proceeds debug output if console debug is enabled
-//and if output is logged then addiional points will be added to graphs
-#define LOG_PROFILE_START(x) LogDebug(x << " " << "profiling##start");
-#define LOG_PROFILE_STOP(x) LogDebug(x << " " << "profiling##stop");
-
+void AddStdoutProfilingMeasurment(const char* name, bool start);
+// profiling script additional proceeds stdout output
+#define LOG_PROFILE_START(x) AddStdoutProfilingMeasurment(x, true)
+#define LOG_PROFILE_STOP(x) AddStdoutProfilingMeasurment(x, false)
 #else //PROFILING_ENABLED
 
 #define ADD_PROFILING_POINT(name, ...) (void)1
index c5f8730..6fc0860 100755 (executable)
@@ -216,7 +216,7 @@ sub dropAndInstallAll {
         }
         my @out = `$WRT_CLIENT_QUERY`;
         for my $line (@out) {
-            if (my ($name, $tizenId) = $line =~ /^\s*\d+\s+(([^ ]| [^ ])+)\s+.*\s+([A-Za-z0-9]+)$/) {
+            if (my ($name, $trash, $tizenId) = $line =~ /^\s*\d+\s+(([^ ]| [^ ])+)\s+.*\s+([A-Za-z0-9]{10})$/) {
                 print "    found $name (tizenId $tizenId)\n";
                 $widgetMap{$name} = $tizenId;
             }
index 5e8df91..4afde4d 100755 (executable)
Binary files a/src/profiling/script/utils/wrt-preloader and b/src/profiling/script/utils/wrt-preloader differ
index 15a0553..70ee600 100644 (file)
@@ -54,6 +54,7 @@ TARGET_LINK_LIBRARIES(${TARGET_BUNDLES_LIB}
     ${BUNDLES_DEP_LIBRARIES}
     ${TARGET_PLUGIN_MODULE_LIB}
     ${TARGET_CORE_MODULE_LIB}
+    ${PROF_LIB}
 )
 
 SET_TARGET_PROPERTIES(${TARGET_BUNDLES_LIB} PROPERTIES