Merge lp:~alexlauni/unity/logging-enhancements into lp:unity

Proposed by Alex Launi on 2010-12-16
Status: Merged
Merged at revision: 715
Proposed branch: lp:~alexlauni/unity/logging-enhancements
Merge into: lp:unity
Diff against target: 88 lines (+29/-11)
3 files modified
CMakeLists.txt (+10/-2)
libunity/perf-logger-utility.h (+17/-8)
src/unity.cpp (+2/-1)
To merge this branch: bzr merge lp:~alexlauni/unity/logging-enhancements
Reviewer Review Type Date Requested Status
Jason Smith (community) 2010-12-16 Approve on 2010-12-16
Review via email: mp+43920@code.launchpad.net

Description of the Change

Adds -DBOOT_LOGGER=ON to Cmake flags to enable unity boot time logging. Also makes boot logging a noop when BOOT_LOGGER is off.

To post a comment you must log in.
Jason Smith (jassmith) wrote :

+1 looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2010-12-09 18:02:17 +0000
3+++ CMakeLists.txt 2010-12-16 15:49:11 +0000
4@@ -72,6 +72,14 @@
5 endif (${GETTEXT_FOUND} STREQUAL "TRUE")
6
7 #
8+# Enable or disable boot logging
9+#
10+option (BOOT_LOGGER "Enable startup performance logging" OFF)
11+if (BOOT_LOGGER)
12+ SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER")
13+endif (BOOT_LOGGER)
14+
15+#
16 # src (Compiz Plugin)
17 #
18 set (UNITY_PLUGIN_DEPS "nux-0.9;libbamf;dbus-glib-1;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib;x11;libstartup-notification-1.0;gthread-2.0;indicator")
19@@ -81,10 +89,10 @@
20 compiz_plugin (unityshell
21 PKGDEPS ${UNITY_PLUGIN_DEPS}
22 PLUGINDEPS composite opengl
23- CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${CMAKE_INSTALL_PREFIX}/share/unity/3\"' -I${CMAKE_BINARY_DIR}"
24+ CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${CMAKE_INSTALL_PREFIX}/share/unity/3\"' -I${CMAKE_BINARY_DIR} ${BOOT_LOGGER_FLAG}"
25 LIBRARIES "unity"
26 )
27-
28+
29 #
30 # GSettings Schema
31 #
32
33=== modified file 'libunity/perf-logger-utility.h'
34--- libunity/perf-logger-utility.h 2010-12-02 12:18:22 +0000
35+++ libunity/perf-logger-utility.h 2010-12-16 15:49:11 +0000
36@@ -21,14 +21,23 @@
37
38 #include <libunity/unity.h>
39
40-#define START_FUNCTION() G_STMT_START { \
41- perf_timeline_logger_start_process (perf_timeline_logger_get_default(), G_STRFUNC);\
42- } G_STMT_END
43-#define LOGGER_START_PROCESS(process) { perf_timeline_logger_start_process (perf_timeline_logger_get_default(), process);}
44+#ifdef ENABLE_LOGGER
45+ #define START_FUNCTION() G_STMT_START { \
46+ perf_timeline_logger_start_process (perf_timeline_logger_get_default(), G_STRFUNC);\
47+ } G_STMT_END
48+ #define LOGGER_START_PROCESS(process) { perf_timeline_logger_start_process (perf_timeline_logger_get_default(), process);}
49
50-#define END_FUNCTION() G_STMT_START { \
51- perf_timeline_logger_end_process (perf_timeline_logger_get_default(), G_STRFUNC);\
52- } G_STMT_END
53-#define LOGGER_END_PROCESS(process) { perf_timeline_logger_end_process (perf_timeline_logger_get_default(), process);}
54+ #define END_FUNCTION() G_STMT_START { \
55+ perf_timeline_logger_end_process (perf_timeline_logger_get_default(), G_STRFUNC);\
56+ } G_STMT_END
57+ #define LOGGER_END_PROCESS(process) { perf_timeline_logger_end_process (perf_timeline_logger_get_default(), process);}
58+ #define LOGGER_WRITE_LOG(file) { perf_timeline_logger_write_log (perf_timeline_logger_get_default(), file);}
59+#else
60+ #define START_FUNCTION()
61+ #define LOGGER_START_PROCESS(process)
62+ #define END_FUNCTION()
63+ #define LOGGER_END_PROCESS(process)
64+ #define LOGGER_WRITE_LOG(file)
65+#endif /* ENABLE_LOGGER */
66
67 #endif /* PERF_LOGGER_H */
68
69=== modified file 'src/unity.cpp'
70--- src/unity.cpp 2010-12-16 09:13:58 +0000
71+++ src/unity.cpp 2010-12-16 15:49:11 +0000
72@@ -368,7 +368,7 @@
73 static gboolean
74 write_logger_data_to_disk (gpointer data)
75 {
76- perf_timeline_logger_write_log (perf_timeline_logger_get_default (), "/tmp/unity-perf.log");
77+ LOGGER_WRITE_LOG ("/tmp/unity-perf.log");
78 return FALSE;
79 }
80
81@@ -415,6 +415,7 @@
82 optionSetLauncherFloatNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
83
84 g_timeout_add (0, &UnityScreen::initPluginActions, this);
85+ g_timeout_add (5000, (GSourceFunc) write_logger_data_to_disk, NULL);
86 END_FUNCTION ();
87 g_timeout_add (5000, write_logger_data_to_disk, NULL);
88 }