Skip to content

Commit

Permalink
delay a little if run without initrd to improve initial resolution.
Browse files Browse the repository at this point in the history
account for split processes' CPU time more correctly.
  • Loading branch information
Michael Meeks committed Jan 25, 2010
1 parent 8528d9a commit 23440d1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
4 changes: 4 additions & 0 deletions bootchartd
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ if [ $$ -eq 1 ]; then
JAIL=$JAIL_MAIN
echo "bootchart: no initrd used; starting" >> /dev/kmsg
start &
# wait a little, until the collector is going, before allowing
# the rest of the system to charge ahead, so we catch it
usleep 500000
echo "bootchart continuing boot" >> /dev/kmsg
wait_boot &
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion pybootchartgui/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def draw_cuml_graph(ctx, proc_tree, chart_bounds):
return;

pix_per_ns = chart_bounds[3] / total_time
print "total time: %g pix-per-ns %g" % (total_time, pix_per_ns)
# print "total time: %g pix-per-ns %g" % (total_time, pix_per_ns)

# FIXME: we really need to aggregate by process name
# FIXME: we have duplicates in the process list too [!] - why !?
Expand Down
18 changes: 15 additions & 3 deletions pybootchartgui/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _parse_taskstats_log(writer, file):
pid += 0.001
pidRewrites[opid] = pid;
# print "process mutation ! '%s' vs '%s' pid %s -> pid %s\n" % (process.cmd, cmd, opid, pid)
process = Process(writer, pid, cmd, ppid, time)
process = process.split (writer, pid, cmd, ppid, time)
processMap[pid] = process
else:
process.cmd = cmd;
Expand Down Expand Up @@ -218,10 +218,18 @@ def _parse_proc_disk_stat_log(file, numCpu):
not sda1, sda2 etc. The format of relevant lines should be:
{major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq}
"""
disk_regex_re = re.compile ('[hsv]d.$')
disk_regex_re = re.compile ('^[hsv]d.$')

# this gets called an awful lot.
def is_relevant_line(linetokens):
return len(linetokens) == 14 and disk_regex_re.match(linetokens[2])
if len(linetokens) != 14:
return False
disk = linetokens[2]
if len (disk) != 3:
return False
if disk == 'sda':
return True
return disk_regex_re.match(disk)

disk_stat_samples = []

Expand Down Expand Up @@ -324,8 +332,12 @@ def _read_le_int32(file):
# FIXME - we don't (yet) use this ... really instead
# of this it would be nice to know who forked a process,
# rather than (per-se) it's self-selected parent.
# In essence having a custom kernel profiling module
# instead.
#
def _parse_pacct(writer, file):
return None # performance - saves 1/2 a second.

pidMap = {}
pidMap[0] = 0

Expand Down
16 changes: 13 additions & 3 deletions pybootchartgui/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,28 @@ def __init__(self, writer, pid, cmd, ppid, start_time):
self.cmd = cmd
self.ppid = ppid
self.start_time = start_time
self.duration = 0
self.samples = []
self.parent = None
self.child_list = []

self.duration = 0

self.active = None

self.last_user_cpu_time = None
self.last_sys_cpu_time = None

self.last_cpu_ns = 0;
self.last_blkio_delay_ns = 0;
self.last_swapin_delay_ns = 0;

# split this process' run - triggered by a name change
def split(self, writer, pid, cmd, ppid, start_time):
split = Process (writer, pid, cmd, ppid, start_time)

split.last_cpu_ns = self.last_cpu_ns;
split.last_blkio_delay_ns = self.last_blkio_delay_ns;
split.last_swapin_delay_ns = self.last_swapin_delay_ns;

return split

def __str__(self):
return " ".join([str(self.pid), self.cmd, str(self.ppid), '[ ' + str(len(self.samples)) + ' samples ]' ])
Expand Down

0 comments on commit 23440d1

Please sign in to comment.