Merge lp:~gordallott/unity/perf-logger into lp:unity
- perf-logger
- Merge into trunk
Proposed by
Gord Allott
Status: | Merged |
---|---|
Merged at revision: | 687 |
Proposed branch: | lp:~gordallott/unity/perf-logger |
Merge into: | lp:unity |
Diff against target: |
626 lines (+151/-92) 7 files modified
CMakeLists.txt (+1/-0) libunity/CMakeLists.txt (+1/-0) libunity/perf-logger-utility.h (+34/-0) libunity/perf-logger.vala (+30/-27) src/unity.cpp (+49/-29) tools/CMakeLists.txt (+1/-1) tools/makebootchart.py (+35/-35) |
To merge this branch: | bzr merge lp:~gordallott/unity/perf-logger |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jason Smith (community) | Approve | ||
Review via email: mp+42594@code.launchpad.net |
Commit message
Description of the change
Adds updates the performance logging code for unity
To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote : | # |
It does have a merge conflict with latest trunk however
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-11-30 15:44:05 +0000 | |||
3 | +++ CMakeLists.txt 2010-12-03 08:41:48 +0000 | |||
4 | @@ -82,6 +82,7 @@ | |||
5 | 82 | PKGDEPS ${UNITY_PLUGIN_DEPS} | 82 | PKGDEPS ${UNITY_PLUGIN_DEPS} |
6 | 83 | PLUGINDEPS composite opengl | 83 | PLUGINDEPS composite opengl |
7 | 84 | CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${CMAKE_INSTALL_PREFIX}/share/unity/3\"' -I${CMAKE_BINARY_DIR}" | 84 | CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${CMAKE_INSTALL_PREFIX}/share/unity/3\"' -I${CMAKE_BINARY_DIR}" |
8 | 85 | LIBRARIES "unity" | ||
9 | 85 | ) | 86 | ) |
10 | 86 | 87 | ||
11 | 87 | # | 88 | # |
12 | 88 | 89 | ||
13 | === modified file 'libunity/CMakeLists.txt' | |||
14 | --- libunity/CMakeLists.txt 2010-11-25 12:08:52 +0000 | |||
15 | +++ libunity/CMakeLists.txt 2010-12-03 08:41:48 +0000 | |||
16 | @@ -50,6 +50,7 @@ | |||
17 | 50 | vala_precompile (VALA_C unity-place-activation.vala | 50 | vala_precompile (VALA_C unity-place-activation.vala |
18 | 51 | unity-place-browser.vala | 51 | unity-place-browser.vala |
19 | 52 | unity-place.vala | 52 | unity-place.vala |
20 | 53 | perf-logger.vala | ||
21 | 53 | PACKAGES gtk+-2.0 gio-2.0 glib-2.0 gobject-2.0 gee-1.0 dbus-glib-1 gio-unix-2.0 | 54 | PACKAGES gtk+-2.0 gio-2.0 glib-2.0 gobject-2.0 gee-1.0 dbus-glib-1 gio-unix-2.0 |
22 | 54 | OPTIONS --thread | 55 | OPTIONS --thread |
23 | 55 | CUSTOM_VAPIS ../vapi/dee-1.0.vapi ../vapi/config.vapi | 56 | CUSTOM_VAPIS ../vapi/dee-1.0.vapi ../vapi/config.vapi |
24 | 56 | 57 | ||
25 | === added file 'libunity/perf-logger-utility.h' | |||
26 | --- libunity/perf-logger-utility.h 1970-01-01 00:00:00 +0000 | |||
27 | +++ libunity/perf-logger-utility.h 2010-12-03 08:41:48 +0000 | |||
28 | @@ -0,0 +1,34 @@ | |||
29 | 1 | /* | ||
30 | 2 | * Copyright (C) 2009-2010 Canonical Ltd | ||
31 | 3 | * | ||
32 | 4 | * This program is free software: you can redistribute it and/or modify | ||
33 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
34 | 6 | * published by the Free Software Foundation. | ||
35 | 7 | * | ||
36 | 8 | * This program is distributed in the hope that it will be useful, | ||
37 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
38 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
39 | 11 | * GNU General Public License for more details. | ||
40 | 12 | * | ||
41 | 13 | * You should have received a copy of the GNU General Public License | ||
42 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
43 | 15 | * | ||
44 | 16 | * Authored by Gordon Allott <gord.allott@canonical.com> | ||
45 | 17 | * | ||
46 | 18 | */ | ||
47 | 19 | #ifndef _PERF_LOGGER_H_ | ||
48 | 20 | #define _PERF_LOGGER_H_ | ||
49 | 21 | |||
50 | 22 | #include <libunity/unity.h> | ||
51 | 23 | |||
52 | 24 | #define START_FUNCTION() G_STMT_START { \ | ||
53 | 25 | perf_timeline_logger_start_process (perf_timeline_logger_get_default(), G_STRFUNC);\ | ||
54 | 26 | } G_STMT_END | ||
55 | 27 | #define LOGGER_START_PROCESS(process) { perf_timeline_logger_start_process (perf_timeline_logger_get_default(), process);} | ||
56 | 28 | |||
57 | 29 | #define END_FUNCTION() G_STMT_START { \ | ||
58 | 30 | perf_timeline_logger_end_process (perf_timeline_logger_get_default(), G_STRFUNC);\ | ||
59 | 31 | } G_STMT_END | ||
60 | 32 | #define LOGGER_END_PROCESS(process) { perf_timeline_logger_end_process (perf_timeline_logger_get_default(), process);} | ||
61 | 33 | |||
62 | 34 | #endif /* PERF_LOGGER_H */ | ||
63 | 0 | 35 | ||
64 | === renamed file 'unity-private/testing/perf-logger.vala' => 'libunity/perf-logger.vala' | |||
65 | --- unity-private/testing/perf-logger.vala 2010-04-07 14:46:55 +0000 | |||
66 | +++ libunity/perf-logger.vala 2010-12-03 08:41:48 +0000 | |||
67 | @@ -1,5 +1,5 @@ | |||
68 | 1 | /* | 1 | /* |
70 | 2 | * Copyright (C) 2009 Canonical Ltd | 2 | * Copyright (C) 2009-2010 Canonical Ltd |
71 | 3 | * | 3 | * |
72 | 4 | * This program is free software: you can redistribute it and/or modify | 4 | * This program is free software: you can redistribute it and/or modify |
73 | 5 | * it under the terms of the GNU General Public License version 3 as | 5 | * it under the terms of the GNU General Public License version 3 as |
74 | @@ -17,9 +17,8 @@ | |||
75 | 17 | * | 17 | * |
76 | 18 | */ | 18 | */ |
77 | 19 | 19 | ||
79 | 20 | namespace Unity | 20 | namespace Perf |
80 | 21 | { | 21 | { |
81 | 22 | |||
82 | 23 | public class ProcessInfo | 22 | public class ProcessInfo |
83 | 24 | { | 23 | { |
84 | 25 | public ProcessInfo (string name) | 24 | public ProcessInfo (string name) |
85 | @@ -32,82 +31,86 @@ | |||
86 | 32 | public double start; | 31 | public double start; |
87 | 33 | public double end; | 32 | public double end; |
88 | 34 | } | 33 | } |
90 | 35 | 34 | ||
91 | 36 | public static TimelineLogger? timeline_singleton; | 35 | public static TimelineLogger? timeline_singleton; |
94 | 37 | public static bool is_logging; | 36 | public static bool is_logging; |
95 | 38 | 37 | ||
96 | 39 | public class TimelineLogger : Object | 38 | public class TimelineLogger : Object |
97 | 40 | { | 39 | { |
98 | 41 | private Timer global_timer; | 40 | private Timer global_timer; |
99 | 42 | private Gee.HashMap<string, ProcessInfo> process_map; | 41 | private Gee.HashMap<string, ProcessInfo> process_map; |
102 | 43 | 42 | ||
103 | 44 | public static unowned Unity.TimelineLogger get_default () | 43 | public static unowned Perf.TimelineLogger get_default () |
104 | 45 | { | 44 | { |
106 | 46 | if (Unity.timeline_singleton == null) | 45 | if (Perf.timeline_singleton == null) |
107 | 47 | { | 46 | { |
109 | 48 | Unity.timeline_singleton = new Unity.TimelineLogger (); | 47 | Perf.timeline_singleton = new Perf.TimelineLogger (); |
110 | 49 | } | 48 | } |
113 | 50 | 49 | ||
114 | 51 | return Unity.timeline_singleton; | 50 | return Perf.timeline_singleton; |
115 | 52 | } | 51 | } |
117 | 53 | 52 | ||
118 | 54 | construct | 53 | construct |
119 | 55 | { | 54 | { |
120 | 56 | this.process_map = new Gee.HashMap<string, ProcessInfo> (); | 55 | this.process_map = new Gee.HashMap<string, ProcessInfo> (); |
122 | 57 | this.global_timer = new Timer (); | 56 | this.global_timer = new Timer (); |
123 | 58 | this.global_timer.start (); | 57 | this.global_timer.start (); |
124 | 59 | } | 58 | } |
126 | 60 | 59 | ||
127 | 61 | public void start_process (string name) | 60 | public void start_process (string name) |
128 | 62 | { | 61 | { |
129 | 62 | debug ("shoop de whoop"); | ||
130 | 63 | if (name in this.process_map.keys) | 63 | if (name in this.process_map.keys) |
131 | 64 | { | 64 | { |
132 | 65 | warning ("already started process: %s", name); | 65 | warning ("already started process: %s", name); |
133 | 66 | return; | 66 | return; |
134 | 67 | } | 67 | } |
136 | 68 | 68 | ||
137 | 69 | var info = new ProcessInfo (name); | 69 | var info = new ProcessInfo (name); |
138 | 70 | this.process_map[name] = info; | 70 | this.process_map[name] = info; |
139 | 71 | info.start = this.global_timer.elapsed (); | 71 | info.start = this.global_timer.elapsed (); |
140 | 72 | } | 72 | } |
142 | 73 | 73 | ||
143 | 74 | public void end_process (string name) | 74 | public void end_process (string name) |
144 | 75 | { | 75 | { |
145 | 76 | debug ("shonk le donk"); | ||
146 | 76 | double end_time = this.global_timer.elapsed (); | 77 | double end_time = this.global_timer.elapsed (); |
148 | 77 | 78 | print ("the end time is %f", end_time); | |
149 | 79 | |||
150 | 78 | if (name in this.process_map.keys) | 80 | if (name in this.process_map.keys) |
151 | 79 | { | 81 | { |
152 | 80 | this.process_map[name].end = end_time; | 82 | this.process_map[name].end = end_time; |
153 | 81 | } | 83 | } |
155 | 82 | else | 84 | else |
156 | 83 | { | 85 | { |
157 | 84 | warning ("process %s not started", name); | 86 | warning ("process %s not started", name); |
158 | 85 | } | 87 | } |
159 | 86 | } | 88 | } |
161 | 87 | 89 | ||
162 | 88 | public void write_log (string filename) | 90 | public void write_log (string filename) |
163 | 89 | { | 91 | { |
164 | 90 | debug ("Writing performance log file: %s...", filename); | 92 | debug ("Writing performance log file: %s...", filename); |
165 | 91 | var log_file = File.new_for_path (filename); | 93 | var log_file = File.new_for_path (filename); |
166 | 92 | FileOutputStream file_stream; | 94 | FileOutputStream file_stream; |
168 | 93 | try | 95 | try |
169 | 94 | { | 96 | { |
170 | 95 | if (!log_file.query_exists (null)) { | 97 | if (!log_file.query_exists (null)) { |
171 | 96 | file_stream = log_file.create (FileCreateFlags.NONE, null); | 98 | file_stream = log_file.create (FileCreateFlags.NONE, null); |
172 | 97 | } | 99 | } |
174 | 98 | else | 100 | else |
175 | 99 | { | 101 | { |
176 | 100 | file_stream = log_file.replace (null, false, FileCreateFlags.NONE, null); | 102 | file_stream = log_file.replace (null, false, FileCreateFlags.NONE, null); |
177 | 101 | } | 103 | } |
179 | 102 | 104 | ||
180 | 103 | var output_stream = new DataOutputStream (file_stream); | 105 | var output_stream = new DataOutputStream (file_stream); |
182 | 104 | 106 | ||
183 | 105 | foreach (ProcessInfo info in this.process_map.values) | 107 | foreach (ProcessInfo info in this.process_map.values) |
184 | 106 | { | 108 | { |
187 | 107 | string outline = "%s, %f, %f\n".printf(info.name, info.start, info.end); | 109 | string name = info.name.replace (",", ";"); |
188 | 108 | output_stream.put_string (outline, null); | 110 | string outline = "%s, %f, %f\n".printf(name, info.start, info.end); |
189 | 111 | output_stream.put_string (outline, null); | ||
190 | 109 | } | 112 | } |
192 | 110 | 113 | ||
193 | 111 | file_stream.close (null); | 114 | file_stream.close (null); |
194 | 112 | } catch (Error e) | 115 | } catch (Error e) |
195 | 113 | { | 116 | { |
196 | 114 | 117 | ||
197 | === modified file 'src/unity.cpp' | |||
198 | --- src/unity.cpp 2010-11-26 09:11:52 +0000 | |||
199 | +++ src/unity.cpp 2010-12-03 08:41:48 +0000 | |||
200 | @@ -39,6 +39,8 @@ | |||
201 | 39 | 39 | ||
202 | 40 | #include <core/atoms.h> | 40 | #include <core/atoms.h> |
203 | 41 | 41 | ||
204 | 42 | #include "../libunity/perf-logger-utility.h" | ||
205 | 43 | |||
206 | 42 | /* Set up vtable symbols */ | 44 | /* Set up vtable symbols */ |
207 | 43 | COMPIZ_PLUGIN_20090315 (unityshell, UnityPluginVTable); | 45 | COMPIZ_PLUGIN_20090315 (unityshell, UnityPluginVTable); |
208 | 44 | 46 | ||
209 | @@ -49,10 +51,10 @@ | |||
210 | 49 | { | 51 | { |
211 | 50 | /* reset matrices */ | 52 | /* reset matrices */ |
212 | 51 | glPushAttrib (GL_VIEWPORT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_COLOR_BUFFER_BIT); | 53 | glPushAttrib (GL_VIEWPORT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_COLOR_BUFFER_BIT); |
214 | 52 | 54 | ||
215 | 53 | glMatrixMode (GL_PROJECTION); | 55 | glMatrixMode (GL_PROJECTION); |
216 | 54 | glPushMatrix (); | 56 | glPushMatrix (); |
218 | 55 | 57 | ||
219 | 56 | glMatrixMode (GL_MODELVIEW); | 58 | glMatrixMode (GL_MODELVIEW); |
220 | 57 | glPushMatrix (); | 59 | glPushMatrix (); |
221 | 58 | 60 | ||
222 | @@ -139,19 +141,19 @@ | |||
223 | 139 | std::vector<nux::Geometry>::iterator it; | 141 | std::vector<nux::Geometry>::iterator it; |
224 | 140 | std::vector<nux::Geometry> dirty = wt->GetDrawList (); | 142 | std::vector<nux::Geometry> dirty = wt->GetDrawList (); |
225 | 141 | nux::Geometry geo; | 143 | nux::Geometry geo; |
227 | 142 | 144 | ||
228 | 143 | for (it = dirty.begin (); it != dirty.end (); it++) | 145 | for (it = dirty.begin (); it != dirty.end (); it++) |
229 | 144 | { | 146 | { |
230 | 145 | geo = *it; | 147 | geo = *it; |
231 | 146 | cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); | 148 | cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); |
232 | 147 | } | 149 | } |
234 | 148 | 150 | ||
235 | 149 | geo = wt->GetWindowCompositor ().GetTooltipMainWindowGeometry(); | 151 | geo = wt->GetWindowCompositor ().GetTooltipMainWindowGeometry(); |
236 | 150 | cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); | 152 | cScreen->damageRegion (CompRegion (geo.x, geo.y, geo.width, geo.height)); |
237 | 151 | cScreen->damageRegion (CompRegion (lastTooltipArea.x, lastTooltipArea.y, lastTooltipArea.width, lastTooltipArea.height)); | 153 | cScreen->damageRegion (CompRegion (lastTooltipArea.x, lastTooltipArea.y, lastTooltipArea.width, lastTooltipArea.height)); |
239 | 152 | 154 | ||
240 | 153 | lastTooltipArea = geo; | 155 | lastTooltipArea = geo; |
242 | 154 | 156 | ||
243 | 155 | wt->ClearDrawList (); | 157 | wt->ClearDrawList (); |
244 | 156 | } | 158 | } |
245 | 157 | 159 | ||
246 | @@ -165,7 +167,7 @@ | |||
247 | 165 | { | 167 | { |
248 | 166 | wt->ProcessForeignEvent (event, NULL); | 168 | wt->ProcessForeignEvent (event, NULL); |
249 | 167 | } | 169 | } |
251 | 168 | } | 170 | } |
252 | 169 | 171 | ||
253 | 170 | 172 | ||
254 | 171 | gboolean | 173 | gboolean |
255 | @@ -258,7 +260,7 @@ | |||
256 | 258 | * stacked on top of one of the nux input windows | 260 | * stacked on top of one of the nux input windows |
257 | 259 | * and if so paint nux and stop us from painting | 261 | * and if so paint nux and stop us from painting |
258 | 260 | * other windows or on top of the whole screen */ | 262 | * other windows or on top of the whole screen */ |
260 | 261 | bool | 263 | bool |
261 | 262 | UnityWindow::glDraw (const GLMatrix &matrix, | 264 | UnityWindow::glDraw (const GLMatrix &matrix, |
262 | 263 | GLFragment::Attrib &attrib, | 265 | GLFragment::Attrib &attrib, |
263 | 264 | const CompRegion ®ion, | 266 | const CompRegion ®ion, |
264 | @@ -278,7 +280,7 @@ | |||
265 | 278 | } | 280 | } |
266 | 279 | 281 | ||
267 | 280 | bool ret = gWindow->glDraw (matrix, attrib, region, mask); | 282 | bool ret = gWindow->glDraw (matrix, attrib, region, mask); |
269 | 281 | 283 | ||
270 | 282 | return ret; | 284 | return ret; |
271 | 283 | } | 285 | } |
272 | 284 | 286 | ||
273 | @@ -293,7 +295,7 @@ | |||
274 | 293 | } | 295 | } |
275 | 294 | 296 | ||
276 | 295 | /* Configure callback for the launcher window */ | 297 | /* Configure callback for the launcher window */ |
278 | 296 | void | 298 | void |
279 | 297 | UnityScreen::launcherWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data) | 299 | UnityScreen::launcherWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data) |
280 | 298 | { | 300 | { |
281 | 299 | int OurWindowHeight = WindowHeight - 24; | 301 | int OurWindowHeight = WindowHeight - 24; |
282 | @@ -301,23 +303,25 @@ | |||
283 | 301 | } | 303 | } |
284 | 302 | 304 | ||
285 | 303 | /* Configure callback for the panel window */ | 305 | /* Configure callback for the panel window */ |
287 | 304 | void | 306 | void |
288 | 305 | UnityScreen::panelWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data) | 307 | UnityScreen::panelWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data) |
289 | 306 | { | 308 | { |
290 | 307 | geo = nux::Geometry(0, 0, WindowWidth, 24); | 309 | geo = nux::Geometry(0, 0, WindowWidth, 24); |
291 | 308 | } | 310 | } |
292 | 309 | 311 | ||
293 | 310 | /* Start up nux after OpenGL is initialized */ | 312 | /* Start up nux after OpenGL is initialized */ |
295 | 311 | void | 313 | void |
296 | 312 | UnityScreen::initUnity(nux::NThread* thread, void* InitData) | 314 | UnityScreen::initUnity(nux::NThread* thread, void* InitData) |
297 | 313 | { | 315 | { |
298 | 316 | START_FUNCTION (); | ||
299 | 314 | initLauncher(thread, InitData); | 317 | initLauncher(thread, InitData); |
301 | 315 | 318 | ||
302 | 316 | nux::ColorLayer background(nux::Color(0x00000000)); | 319 | nux::ColorLayer background(nux::Color(0x00000000)); |
303 | 317 | static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background); | 320 | static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background); |
304 | 321 | END_FUNCTION (); | ||
305 | 318 | } | 322 | } |
306 | 319 | 323 | ||
308 | 320 | void | 324 | void |
309 | 321 | UnityScreen::onRedrawRequested () | 325 | UnityScreen::onRedrawRequested () |
310 | 322 | { | 326 | { |
311 | 323 | damageNuxRegions (); | 327 | damageNuxRegions (); |
312 | @@ -342,6 +346,13 @@ | |||
313 | 342 | } | 346 | } |
314 | 343 | } | 347 | } |
315 | 344 | 348 | ||
316 | 349 | static gboolean | ||
317 | 350 | write_logger_data_to_disk (gpointer data) | ||
318 | 351 | { | ||
319 | 352 | perf_timeline_logger_write_log (perf_timeline_logger_get_default (), "/tmp/unity-perf.log"); | ||
320 | 353 | return FALSE; | ||
321 | 354 | } | ||
322 | 355 | |||
323 | 345 | UnityScreen::UnityScreen (CompScreen *screen) : | 356 | UnityScreen::UnityScreen (CompScreen *screen) : |
324 | 346 | PluginClassHandler <UnityScreen, CompScreen> (screen), | 357 | PluginClassHandler <UnityScreen, CompScreen> (screen), |
325 | 347 | screen (screen), | 358 | screen (screen), |
326 | @@ -349,35 +360,37 @@ | |||
327 | 349 | gScreen (GLScreen::get (screen)), | 360 | gScreen (GLScreen::get (screen)), |
328 | 350 | doShellRepaint (false) | 361 | doShellRepaint (false) |
329 | 351 | { | 362 | { |
330 | 363 | START_FUNCTION (); | ||
331 | 352 | int (*old_handler) (Display *, XErrorEvent *); | 364 | int (*old_handler) (Display *, XErrorEvent *); |
332 | 353 | old_handler = XSetErrorHandler (NULL); | 365 | old_handler = XSetErrorHandler (NULL); |
334 | 354 | 366 | ||
335 | 355 | g_thread_init (NULL); | 367 | g_thread_init (NULL); |
336 | 356 | dbus_g_thread_init (); | 368 | dbus_g_thread_init (); |
337 | 357 | gtk_init (NULL, NULL); | 369 | gtk_init (NULL, NULL); |
339 | 358 | 370 | ||
340 | 359 | XSetErrorHandler (old_handler); | 371 | XSetErrorHandler (old_handler); |
341 | 360 | 372 | ||
342 | 361 | /* Wrap compiz interfaces */ | 373 | /* Wrap compiz interfaces */ |
343 | 362 | ScreenInterface::setHandler (screen); | 374 | ScreenInterface::setHandler (screen); |
344 | 363 | CompositeScreenInterface::setHandler (cScreen); | 375 | CompositeScreenInterface::setHandler (cScreen); |
345 | 364 | GLScreenInterface::setHandler (gScreen); | 376 | GLScreenInterface::setHandler (gScreen); |
347 | 365 | 377 | ||
348 | 366 | StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ()); | 378 | StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ()); |
349 | 367 | 379 | ||
350 | 368 | nux::NuxInitialize (0); | 380 | nux::NuxInitialize (0); |
353 | 369 | wt = nux::CreateFromForeignWindow (cScreen->output (), | 381 | wt = nux::CreateFromForeignWindow (cScreen->output (), |
354 | 370 | glXGetCurrentContext (), | 382 | glXGetCurrentContext (), |
355 | 371 | &UnityScreen::initUnity, | 383 | &UnityScreen::initUnity, |
356 | 372 | this); | 384 | this); |
358 | 373 | 385 | ||
359 | 374 | wt->RedrawRequested.connect (sigc::mem_fun (this, &UnityScreen::onRedrawRequested)); | 386 | wt->RedrawRequested.connect (sigc::mem_fun (this, &UnityScreen::onRedrawRequested)); |
361 | 375 | 387 | END_FUNCTION (); | |
362 | 388 | g_timeout_add (10, write_logger_data_to_disk, NULL); | ||
363 | 376 | wt->Run (NULL); | 389 | wt->Run (NULL); |
364 | 377 | uScreen = this; | 390 | uScreen = this; |
365 | 378 | 391 | ||
366 | 379 | debugger = new IntrospectionDBusInterface (this); | 392 | debugger = new IntrospectionDBusInterface (this); |
368 | 380 | 393 | ||
369 | 381 | PluginAdapter::Initialize (screen); | 394 | PluginAdapter::Initialize (screen); |
370 | 382 | 395 | ||
371 | 383 | optionSetLauncherAutohideNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); | 396 | optionSetLauncherAutohideNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); |
372 | @@ -393,25 +406,28 @@ | |||
373 | 393 | /* Can't create windows until after we have initialized everything */ | 406 | /* Can't create windows until after we have initialized everything */ |
374 | 394 | gboolean UnityScreen::strutHackTimeout (gpointer data) | 407 | gboolean UnityScreen::strutHackTimeout (gpointer data) |
375 | 395 | { | 408 | { |
378 | 396 | UnityScreen *self = (UnityScreen*) data; | 409 | UnityScreen *self = (UnityScreen*) data; |
379 | 397 | 410 | ||
380 | 398 | if (!self->launcher->AutohideEnabled ()) | 411 | if (!self->launcher->AutohideEnabled ()) |
381 | 399 | { | 412 | { |
382 | 400 | self->launcherWindow->InputWindowEnableStruts(false); | 413 | self->launcherWindow->InputWindowEnableStruts(false); |
383 | 401 | self->launcherWindow->InputWindowEnableStruts(true); | 414 | self->launcherWindow->InputWindowEnableStruts(true); |
384 | 402 | } | 415 | } |
386 | 403 | 416 | ||
387 | 404 | self->panelWindow->InputWindowEnableStruts(false); | 417 | self->panelWindow->InputWindowEnableStruts(false); |
388 | 405 | self->panelWindow->InputWindowEnableStruts(true); | 418 | self->panelWindow->InputWindowEnableStruts(true); |
390 | 406 | 419 | ||
391 | 407 | return FALSE; | 420 | return FALSE; |
392 | 408 | } | 421 | } |
393 | 409 | 422 | ||
394 | 410 | /* Start up the launcher */ | 423 | /* Start up the launcher */ |
395 | 411 | void UnityScreen::initLauncher (nux::NThread* thread, void* InitData) | 424 | void UnityScreen::initLauncher (nux::NThread* thread, void* InitData) |
396 | 412 | { | 425 | { |
397 | 426 | START_FUNCTION (); | ||
398 | 427 | |||
399 | 413 | UnityScreen *self = (UnityScreen*) InitData; | 428 | UnityScreen *self = (UnityScreen*) InitData; |
401 | 414 | 429 | ||
402 | 430 | LOGGER_START_PROCESS ("initLauncher-Launcher"); | ||
403 | 415 | self->launcherWindow = new nux::BaseWindow(TEXT("")); | 431 | self->launcherWindow = new nux::BaseWindow(TEXT("")); |
404 | 416 | self->launcher = new Launcher(self->launcherWindow); | 432 | self->launcher = new Launcher(self->launcherWindow); |
405 | 417 | self->AddChild (self->launcher); | 433 | self->AddChild (self->launcher); |
406 | @@ -434,8 +450,10 @@ | |||
407 | 434 | self->launcherWindow->InputWindowEnableStruts(true); | 450 | self->launcherWindow->InputWindowEnableStruts(true); |
408 | 435 | 451 | ||
409 | 436 | self->launcher->SetIconSize (54, 48); | 452 | self->launcher->SetIconSize (54, 48); |
410 | 453 | LOGGER_END_PROCESS ("initLauncher-Launcher"); | ||
411 | 437 | 454 | ||
412 | 438 | /* Setup panel */ | 455 | /* Setup panel */ |
413 | 456 | LOGGER_START_PROCESS ("initLauncher-Panel"); | ||
414 | 439 | self->panelView = new PanelView (); | 457 | self->panelView = new PanelView (); |
415 | 440 | self->AddChild (self->panelView); | 458 | self->AddChild (self->panelView); |
416 | 441 | 459 | ||
417 | @@ -454,10 +472,12 @@ | |||
418 | 454 | self->panelWindow->SetBackgroundColor(nux::Color(0x00000000)); | 472 | self->panelWindow->SetBackgroundColor(nux::Color(0x00000000)); |
419 | 455 | self->panelWindow->SetBlurredBackground(false); | 473 | self->panelWindow->SetBlurredBackground(false); |
420 | 456 | self->panelWindow->ShowWindow(true); | 474 | self->panelWindow->ShowWindow(true); |
422 | 457 | self->panelWindow->EnableInputWindow(true); | 475 | self->panelWindow->EnableInputWindow(true); |
423 | 458 | self->panelWindow->InputWindowEnableStruts(true); | 476 | self->panelWindow->InputWindowEnableStruts(true); |
425 | 459 | 477 | LOGGER_END_PROCESS ("initLauncher-Panel"); | |
426 | 460 | g_timeout_add (2000, &UnityScreen::strutHackTimeout, self); | 478 | g_timeout_add (2000, &UnityScreen::strutHackTimeout, self); |
427 | 479 | |||
428 | 480 | END_FUNCTION (); | ||
429 | 461 | } | 481 | } |
430 | 462 | 482 | ||
431 | 463 | /* Window init */ | 483 | /* Window init */ |
432 | 464 | 484 | ||
433 | === modified file 'tools/CMakeLists.txt' | |||
434 | --- tools/CMakeLists.txt 2010-11-25 15:56:14 +0000 | |||
435 | +++ tools/CMakeLists.txt 2010-12-03 08:41:48 +0000 | |||
436 | @@ -1,5 +1,5 @@ | |||
437 | 1 | # | 1 | # |
438 | 2 | # Some unity tools | 2 | # Some unity tools |
439 | 3 | # | 3 | # |
441 | 4 | install(FILES migrate_favorites.py PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/) | 4 | install(FILES makebootchart.py migrate_favorites.py PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unity/) |
442 | 5 | 5 | ||
443 | 6 | 6 | ||
444 | === modified file 'tools/makebootchart.py' | |||
445 | --- tools/makebootchart.py 2010-01-15 12:28:51 +0000 | |||
446 | +++ tools/makebootchart.py 2010-12-03 08:41:48 +0000 | |||
447 | @@ -24,8 +24,8 @@ | |||
448 | 24 | import math | 24 | import math |
449 | 25 | import random | 25 | import random |
450 | 26 | from string import Template | 26 | from string import Template |
453 | 27 | from socket import gethostname | 27 | from socket import gethostname |
454 | 28 | from datetime import datetime | 28 | from datetime import datetime |
455 | 29 | import re | 29 | import re |
456 | 30 | import subprocess | 30 | import subprocess |
457 | 31 | 31 | ||
458 | @@ -39,22 +39,22 @@ | |||
459 | 39 | if x["start"] - y["start"] < 0: | 39 | if x["start"] - y["start"] < 0: |
460 | 40 | return -1 | 40 | return -1 |
461 | 41 | else: | 41 | else: |
464 | 42 | return +1 | 42 | return +1 |
465 | 43 | 43 | ||
466 | 44 | def gatherinfo (filename): | 44 | def gatherinfo (filename): |
467 | 45 | date = datetime.fromtimestamp(os.path.getmtime(filename)) | 45 | date = datetime.fromtimestamp(os.path.getmtime(filename)) |
469 | 46 | 46 | ||
470 | 47 | cpufile = open ("/proc/cpuinfo") | 47 | cpufile = open ("/proc/cpuinfo") |
471 | 48 | cpuinfo = cpufile.read (10024) | 48 | cpuinfo = cpufile.read (10024) |
472 | 49 | cpure = re.search (r"^model name\s*: (.*$)", cpuinfo, re.MULTILINE) | 49 | cpure = re.search (r"^model name\s*: (.*$)", cpuinfo, re.MULTILINE) |
473 | 50 | cpu = cpure.group(1) | 50 | cpu = cpure.group(1) |
475 | 51 | 51 | ||
476 | 52 | gpu_prog = subprocess.Popen("glxinfo", stdout=subprocess.PIPE) | 52 | gpu_prog = subprocess.Popen("glxinfo", stdout=subprocess.PIPE) |
478 | 53 | gpu_prog.wait () | 53 | gpu_prog.wait () |
479 | 54 | gpuinfo = gpu_prog.stdout.read (10024) | 54 | gpuinfo = gpu_prog.stdout.read (10024) |
480 | 55 | gpure = re.search (r"^OpenGL renderer string: (.*$)", gpuinfo, re.MULTILINE) | 55 | gpure = re.search (r"^OpenGL renderer string: (.*$)", gpuinfo, re.MULTILINE) |
481 | 56 | gpu = gpure.group (1) | 56 | gpu = gpure.group (1) |
483 | 57 | 57 | ||
484 | 58 | return {"hostname":gethostname(), | 58 | return {"hostname":gethostname(), |
485 | 59 | "date": date.strftime("%A, %d. %B %Y %I:%M%p"), | 59 | "date": date.strftime("%A, %d. %B %Y %I:%M%p"), |
486 | 60 | "uname": " ".join (os.uname ()), | 60 | "uname": " ".join (os.uname ()), |
487 | @@ -67,14 +67,14 @@ | |||
488 | 67 | bar_height = 16 | 67 | bar_height = 16 |
489 | 68 | 68 | ||
490 | 69 | def draw_bg_graph (ctx, seconds, height): | 69 | def draw_bg_graph (ctx, seconds, height): |
492 | 70 | 70 | ||
493 | 71 | total_width = seconds * width_multiplier | 71 | total_width = seconds * width_multiplier |
494 | 72 | ctx.set_source_rgba (0.0, 0.0, 0.0, 0.25) | 72 | ctx.set_source_rgba (0.0, 0.0, 0.0, 0.25) |
496 | 73 | 73 | ||
497 | 74 | ctx.move_to (0, 0) | 74 | ctx.move_to (0, 0) |
498 | 75 | ctx.line_to (total_width, 0) | 75 | ctx.line_to (total_width, 0) |
499 | 76 | ctx.stroke () | 76 | ctx.stroke () |
501 | 77 | 77 | ||
502 | 78 | per_ten = 0 | 78 | per_ten = 0 |
503 | 79 | for pos in xrange (0, int(total_width), int (0.01 * width_multiplier)): | 79 | for pos in xrange (0, int(total_width), int (0.01 * width_multiplier)): |
504 | 80 | ctx.set_line_width (1) | 80 | ctx.set_line_width (1) |
505 | @@ -90,67 +90,67 @@ | |||
506 | 90 | ctx.move_to (pos, 0) | 90 | ctx.move_to (pos, 0) |
507 | 91 | ctx.line_to (pos, height) | 91 | ctx.line_to (pos, height) |
508 | 92 | ctx.stroke () | 92 | ctx.stroke () |
510 | 93 | 93 | ||
511 | 94 | per_ten += 1 | 94 | per_ten += 1 |
512 | 95 | per_ten %= 10 | 95 | per_ten %= 10 |
513 | 96 | 96 | ||
514 | 97 | def build_graph (data, filename, info): | 97 | def build_graph (data, filename, info): |
516 | 98 | 98 | ||
517 | 99 | padding_left = 6 | 99 | padding_left = 6 |
518 | 100 | padding_right = 100 | 100 | padding_right = 100 |
519 | 101 | padding_top = 6 | 101 | padding_top = 6 |
520 | 102 | padding_bottom = 6 | 102 | padding_bottom = 6 |
522 | 103 | 103 | ||
523 | 104 | total_size = 0.0 | 104 | total_size = 0.0 |
524 | 105 | for item in data: | 105 | for item in data: |
525 | 106 | if item['end'] > total_size: | 106 | if item['end'] > total_size: |
526 | 107 | total_size = item['end'] | 107 | total_size = item['end'] |
528 | 108 | 108 | ||
529 | 109 | width = total_size * width_multiplier + padding_left + padding_right | 109 | width = total_size * width_multiplier + padding_left + padding_right |
530 | 110 | height = (len(data) * (bar_height)) + 80 + padding_bottom + padding_top | 110 | height = (len(data) * (bar_height)) + 80 + padding_bottom + padding_top |
533 | 111 | surface = cairo.SVGSurface(filename, width, height) | 111 | surface = cairo.SVGSurface(filename, max (width, 800), max (height, 600)) |
534 | 112 | 112 | ||
535 | 113 | ctx = cairo.Context (surface) | 113 | ctx = cairo.Context (surface) |
536 | 114 | 114 | ||
537 | 115 | #fill background | 115 | #fill background |
538 | 116 | ctx.set_source_rgb (1, 1, 1) | 116 | ctx.set_source_rgb (1, 1, 1) |
540 | 117 | ctx.rectangle (0, 0, width, height) | 117 | ctx.rectangle (0, 0, max (width, 800), max (height, 600)) |
541 | 118 | ctx.fill () | 118 | ctx.fill () |
543 | 119 | 119 | ||
544 | 120 | #print header | 120 | #print header |
545 | 121 | info['total_time'] = "%s secs" % total_size | 121 | info['total_time'] = "%s secs" % total_size |
546 | 122 | sheader = header.substitute(info) | 122 | sheader = header.substitute(info) |
548 | 123 | 123 | ||
549 | 124 | ctx.translate (padding_left, padding_top) | 124 | ctx.translate (padding_left, padding_top) |
550 | 125 | ctx.set_source_rgb (0, 0, 0) | 125 | ctx.set_source_rgb (0, 0, 0) |
551 | 126 | for line in sheader.split("\n"): | 126 | for line in sheader.split("\n"): |
552 | 127 | ctx.translate (0, 12) | 127 | ctx.translate (0, 12) |
553 | 128 | ctx.show_text (line) | 128 | ctx.show_text (line) |
554 | 129 | ctx.fill () | 129 | ctx.fill () |
560 | 130 | 130 | ||
561 | 131 | ctx.translate (0, 12) | 131 | ctx.translate (6, 12) |
562 | 132 | 132 | ||
563 | 133 | draw_bg_graph (ctx, total_size, len (data) * bar_height + 16) | 133 | draw_bg_graph (ctx, total_size + 0.5, max (len (data) * bar_height + 64, 500)) |
564 | 134 | 134 | ||
565 | 135 | ctx.set_line_width (1) | 135 | ctx.set_line_width (1) |
566 | 136 | for item in data: | 136 | for item in data: |
567 | 137 | x = item['start'] * width_multiplier | 137 | x = item['start'] * width_multiplier |
568 | 138 | x1 = (item['end'] - item['start']) * width_multiplier | 138 | x1 = (item['end'] - item['start']) * width_multiplier |
569 | 139 | ctx.translate (x, 0) | 139 | ctx.translate (x, 0) |
571 | 140 | 140 | ||
572 | 141 | ctx.set_source_rgba (0.35, 0.65, 0.8, 0.5) | 141 | ctx.set_source_rgba (0.35, 0.65, 0.8, 0.5) |
573 | 142 | ctx.rectangle (0, 0, x1, 16) | 142 | ctx.rectangle (0, 0, x1, 16) |
574 | 143 | ctx.fill () | 143 | ctx.fill () |
576 | 144 | 144 | ||
577 | 145 | ctx.set_source_rgba (0.35, 0.65, 0.8, 1.0) | 145 | ctx.set_source_rgba (0.35, 0.65, 0.8, 1.0) |
578 | 146 | ctx.rectangle (0, 0, x1, 16) | 146 | ctx.rectangle (0, 0, x1, 16) |
579 | 147 | ctx.stroke () | 147 | ctx.stroke () |
581 | 148 | 148 | ||
582 | 149 | ctx.translate (8, 10) | 149 | ctx.translate (8, 10) |
583 | 150 | ctx.set_source_rgb (0.0, 0.0, 0.0) | 150 | ctx.set_source_rgb (0.0, 0.0, 0.0) |
585 | 151 | ctx.show_text ("%s %.2f seconds" % (item['name'], round (item["end"] - item["start"], 2))) | 151 | ctx.show_text ("%s %.4f seconds" % (item['name'], item["end"] - item["start"])) |
586 | 152 | ctx.fill() | 152 | ctx.fill() |
588 | 153 | 153 | ||
589 | 154 | ctx.translate (-x-8, 6) | 154 | ctx.translate (-x-8, 6) |
590 | 155 | 155 | ||
591 | 156 | def build_data_structure (input): | 156 | def build_data_structure (input): |
592 | @@ -162,13 +162,13 @@ | |||
593 | 162 | start = float(row[1]) | 162 | start = float(row[1]) |
594 | 163 | end = float(row[2]) | 163 | end = float(row[2]) |
595 | 164 | structure.append ({"name": name, "start": start, "end": end}) | 164 | structure.append ({"name": name, "start": start, "end": end}) |
597 | 165 | 165 | ||
598 | 166 | structure.sort (sort_by_domain) | 166 | structure.sort (sort_by_domain) |
599 | 167 | return structure | 167 | return structure |
601 | 168 | 168 | ||
602 | 169 | 169 | ||
603 | 170 | def usage(): | 170 | def usage(): |
605 | 171 | print "use --input=filename.log and --output=filename.svg :)" | 171 | print "use --input=filename.log and --output=filename.svg :)" |
606 | 172 | 172 | ||
607 | 173 | def main(): | 173 | def main(): |
608 | 174 | 174 | ||
609 | @@ -179,7 +179,7 @@ | |||
610 | 179 | print str(err) # will print something like "option -a not recognized" | 179 | print str(err) # will print something like "option -a not recognized" |
611 | 180 | usage() | 180 | usage() |
612 | 181 | sys.exit(2) | 181 | sys.exit(2) |
614 | 182 | 182 | ||
615 | 183 | output = None | 183 | output = None |
616 | 184 | input = None | 184 | input = None |
617 | 185 | for o, a in opts: | 185 | for o, a in opts: |
618 | @@ -196,7 +196,7 @@ | |||
619 | 196 | if (not output or not input): | 196 | if (not output or not input): |
620 | 197 | usage() | 197 | usage() |
621 | 198 | sys.exit() | 198 | sys.exit() |
623 | 199 | 199 | ||
624 | 200 | data = build_data_structure (input) | 200 | data = build_data_structure (input) |
625 | 201 | info = gatherinfo (input) | 201 | info = gatherinfo (input) |
626 | 202 | build_graph (data, output, info) | 202 | build_graph (data, output, info) |
+1 code looks good, everything seems to be in order