Hi guys, First - thanks for the great python re-write of bootchart :-) it inspired me to hack it. I attach possibly the world's most ugly hack ;-) but perhaps it is useful. The aim is to allow an application to provoke boot-chart into separating out various sections of it's run by the insertion of a few simple commands. This should then help out with working out which the particularly slow bits are - much like Federico's scattering of the code with 'access' calls, and then stracing I guess :-) [ except perhaps with lower overhead ]. The basic idea is Rob's - and for an impl. I poked at moblin's mutter - adding some patch like the second attached. Essentially renaming the binary at certain intervals by doing: prctl (PR_SET_NAME, "mutt-make-panel", 0, 0, 0); (sadly it only takes 16 character names for whatever reason). I attach a sample bootchart run of that system. This has the effect of making mutter appear to be separate processes. Crack smoking ? no doubt ;-) comments much appreciated on cleaning it up. Also (despite my lamest efforts) at reading the --help output; pybootchartgui managed to resist my attempts to generate an svg file - at least until I read the code, and discovered that -o in and of itself is no use without an equivalent -f option :-) I append another patch to make that more intuitive (at least for me). HTH, Michael. -- michael meeks novell com <><, Pseudo Engineer, itinerant idiot
diff -u -r /home/michael/backup/pybootchartgui/parsing.py pybootchartgui/parsing.py --- a/pybootchartgui-r124/pybootchartgui/parsing.py +++ b/pybootchartgui-r124/pybootchartgui/parsing.py @@ -50,6 +50,7 @@ * kstkesp, kstkeip} """ processMap = {} + pidRewrites = {} ltime = 0 timed_blocks = _parse_timed_blocks(file) for time, lines in timed_blocks: @@ -57,12 +58,26 @@ tokens = line.split(' ') offset = [index for index, token in enumerate(tokens[1:]) if token.endswith(')')][0] - pid, cmd, state, ppid = int(tokens[0]), ' '.join(tokens[1:2+offset]), tokens[2+offset], int(tokens[3+offset]) + opid, cmd, state, ppid = float(tokens[0]), ' '.join(tokens[1:2+offset]), tokens[2+offset], int(tokens[3+offset]) userCpu, sysCpu, stime= int(tokens[13+offset]), int(tokens[14+offset]), int(tokens[21+offset]) + # when the process name changes, we re-write the pid. + if pidRewrites.has_key(opid): + pid = pidRewrites[opid]; + else: + pid = opid; + + cmd = cmd.strip('(').strip(')') if processMap.has_key(pid): process = processMap[pid] - process.cmd = cmd.replace('(', '').replace(')', '') # why rename after latest name?? + if process.cmd != cmd: + pid += 0.001 + pidRewrites[opid] = pid; +# print "process mutation ! '%s' vs '%s' pid %s -> pid %s\n" % (process.cmd, cmd, opid, pid) + process = Process(pid, cmd, ppid, time) + processMap[pid] = process + else: + process.cmd = cmd; else: process = Process(pid, cmd, ppid, min(time, stime)) processMap[pid] = process --- a/pybootchartgui-r124/pybootchartgui/samples.py +++ b/pybootchartgui-r124/pybootchartgui/samples.py @@ -34,7 +34,7 @@ class Process: def __init__(self, pid, cmd, ppid, start_time): self.pid = pid - self.cmd = cmd.strip('(').strip(')') + self.cmd = cmd; self.ppid = ppid self.start_time = start_time self.samples = []
diff --git a/src/moblin-netbook-panel.c b/src/moblin-netbook-panel.c index 883c0c0..26e3c97 100644 --- a/src/moblin-netbook-panel.c +++ b/src/moblin-netbook-panel.c @@ -27,6 +27,7 @@ #endif #include <string.h> +#include <sys/prctl.h> #include "moblin-netbook.h" #include "moblin-netbook-panel.h" @@ -611,6 +612,8 @@ make_panel (MutterPlugin *plugin, gint width) time_t t; struct tm *tmp; + prctl (PR_SET_NAME, "mutt-make-panel", 0, 0, 0); + mutter_plugin_query_screen_size (plugin, &screen_width, &screen_height); overlay = mutter_plugin_get_overlay_group (plugin); @@ -738,6 +741,9 @@ make_panel (MutterPlugin *plugin, gint width) (GSourceFunc) start_update_time_date, priv); + + prctl (PR_SET_NAME, "mutt-do-detail", 0, 0, 0); + /* status drop down */ priv->status = make_status (plugin, width - PANEL_X_PADDING * 2); clutter_container_add_actor (CLUTTER_CONTAINER (panel), priv->status); @@ -887,5 +893,7 @@ make_panel (MutterPlugin *plugin, gint width) if (shadow) clutter_actor_lower_bottom (shadow); + prctl (PR_SET_NAME, "mutt-show-mzone", 0, 0, 0); + return panel; }
Attachment:
play.tgz
Description: application/compressed-tar
Attachment:
bootc.png
Description: PNG image
--- a/pybootchartgui-r124/pybootchartgui/batch.py +++ a/pybootchartgui-r124/pybootchartgui/batch.py @@ -9,6 +9,9 @@ "svg": (lambda w,h: cairo.SVGSurface(filename, w, h), lambda sfc: 0) } + if format is None: + format = filename.rsplit('.',1)[0]; + if not(handlers.has_key(format)): print "Unknown format '%s'." % format return 10 --- a/pybootchartgui-r124/pybootchartgui/main.py +++ a/pybootchartgui-r124/pybootchartgui/main.py @@ -55,7 +55,7 @@ return 2 res = parsing.parse(args, options.prune) - if options.interactive or options.format == None: + if options.interactive or options.output == None: gui.show(res) else: filename = _get_filename(args, options)