From 3d0aa2fbccf5b814515fff6186cea07a83cd853b Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 11 Jan 2010 16:57:20 +0000 Subject: [PATCH] more work --- Makefile | 1 - TODO | 7 +++++++ pybootchartgui/draw.py | 6 ++++-- pybootchartgui/parsing.py | 16 ++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index deb5472..11bf1c4 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ VER=0.0.3 PKG_NAME=bootchart2 PKG_TARBALL=$(PKG_NAME)-$(VER).tar.bz2 -nurgh CC = gcc CFLAGS = -g -Wall -Os diff --git a/TODO b/TODO index fbf00f8..ced6c52 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,8 @@ +** Bugs: + + Ensure that we merge up a sub-process' CPU usage into the + parent process when we hide very short running processes. + +** Features: Woah, there is some -serious- rounding error on the sample data ... what is a CPU sample !? ... @@ -6,6 +11,7 @@ we only see a ms at a time - which sucks [!] lets up-res the old-style / bog-standard samples. + Account for the time taken to run the bootchart-collector ... + scale all other times by this ammount [!] ;-) + to make it -appear- as if it doesn't impact the system :-) @@ -48,3 +54,4 @@ Process taskstats in advance * Export ODF, with a number of pie charts in it etc. + export cumulative data for rendering in ods ? + rather than adding manual rendering - which sucks (!?) + diff --git a/pybootchartgui/draw.py b/pybootchartgui/draw.py index e23f964..a0acb44 100644 --- a/pybootchartgui/draw.py +++ b/pybootchartgui/draw.py @@ -300,7 +300,9 @@ def render(ctx, options, xscale, headers, cpu_stats, disk_stats, proc_tree, time ctx.set_font_size(SIG_FONT_SIZE) draw_text(ctx, SIGNATURE, SIG_COLOR, off_x + 5, h - off_y - 5) - draw_cuml_graph(ctx, proc_tree, 5, h, w, 500) +# draw a cumulative CPU time per-process graph at the bottom ... +# see from the wiggles in it where we're waiting / blocking (?) +# draw_cuml_graph(ctx, proc_tree, 5, h, w, 500) def accumulate_time(name_to_cuml_t, proc): @@ -405,7 +407,7 @@ def draw_process_activity_colors(ctx, proc, proc_tree, x, y, w, proc_h, rect): color = STATE_COLORS[state] if state == STATE_RUNNING: - alpha = 1.0 #min (sample.cpu_sample.user + sample.cpu_sample.sys, 1.0) + alpha = min (sample.cpu_sample.user + sample.cpu_sample.sys, 1.0) color = tuple(list(PROC_COLOR_R[0:3]) + [alpha]) # print "render time %d [ tx %d tw %d ], sample state %s color %s alpha %g" % (sample.time, tx, tw, state, color, alpha) elif state == STATE_SLEEPING: diff --git a/pybootchartgui/parsing.py b/pybootchartgui/parsing.py index 3e05f94..e2c6570 100644 --- a/pybootchartgui/parsing.py +++ b/pybootchartgui/parsing.py @@ -153,9 +153,9 @@ def _parse_taskstats_log(writer, file): process = Process(writer, pid, cmd, ppid, time) processMap[pid] = process - delta_cpu_ns = (int) (cpu_ns - process.last_cpu_ns) - delta_blkio_delay_ns = (int) (blkio_delay_ns - process.last_blkio_delay_ns) - delta_swapin_delay_ns = (int) (swapin_delay_ns - process.last_swapin_delay_ns) + delta_cpu_ns = (float) (cpu_ns - process.last_cpu_ns) + delta_blkio_delay_ns = (float) (blkio_delay_ns - process.last_blkio_delay_ns) + delta_swapin_delay_ns = (float) (swapin_delay_ns - process.last_swapin_delay_ns) # make up some state data ... if delta_cpu_ns > 0: @@ -165,12 +165,12 @@ def _parse_taskstats_log(writer, file): else: state = "S" -# FIXME - we really need to render these more accurately - retaining higher precision to rendering. - ms_to_ns = 1000000; + # retain the ns timing information into a CPUSample - that tries + # with the old-style to be a %age of CPU used in this time-slice. if delta_cpu_ns + delta_blkio_delay_ns + delta_swapin_delay_ns > 0: - cpuSample = CPUSample('null', delta_cpu_ns / ms_to_ns, 0.0, - delta_blkio_delay_ns / ms_to_ns, - delta_swapin_delay_ns / ms_to_ns) + cpuSample = CPUSample('null', delta_cpu_ns, 0.0, + delta_blkio_delay_ns, + delta_swapin_delay_ns) process.samples.append(ProcessSample(time, state, cpuSample)) process.last_cpu_ns = cpu_ns