summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-30 10:50:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 10:37:59 +0000
commit1416bb3244696d554431cf5549c59575e9a2c045 (patch)
treee7dd40a2e244a5a3599ebe53b17d20dae1ebeef6 /scripts
parent521887ea61b27b33023d6aac9df352d1fdef3ec0 (diff)
downloadpoky-1416bb3244696d554431cf5549c59575e9a2c045.tar.gz
pybootchartgui/draw.py: skip empty CPU and disk usage charts
The only real change is the addition of two if checks that skips the corresponding drawing code when there is no data. (From OE-Core rev: 1658fd5e9ca1ba793cae604c2a395d54e3ec9056) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/draw.py98
1 files changed, 50 insertions, 48 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py
index bddd8048c9..ec5dd333a1 100644
--- a/scripts/pybootchartgui/pybootchartgui/draw.py
+++ b/scripts/pybootchartgui/pybootchartgui/draw.py
@@ -344,56 +344,58 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w):
344 proc_tree = options.proc_tree(trace) 344 proc_tree = options.proc_tree(trace)
345 345
346 # render bar legend 346 # render bar legend
347 ctx.set_font_size(LEGEND_FONT_SIZE) 347 if trace.cpu_stats:
348 348 ctx.set_font_size(LEGEND_FONT_SIZE)
349 draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s) 349
350 draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s) 350 draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s)
351 351 draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s)
352 # render I/O wait 352
353 chart_rect = (off_x, curr_y+30, w, bar_h) 353 # render I/O wait
354 if clip_visible (clip, chart_rect): 354 chart_rect = (off_x, curr_y+30, w, bar_h)
355 draw_box_ticks (ctx, chart_rect, sec_w) 355 if clip_visible (clip, chart_rect):
356 draw_annotations (ctx, proc_tree, trace.times, chart_rect) 356 draw_box_ticks (ctx, chart_rect, sec_w)
357 draw_chart (ctx, IO_COLOR, True, chart_rect, \ 357 draw_annotations (ctx, proc_tree, trace.times, chart_rect)
358 [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], \ 358 draw_chart (ctx, IO_COLOR, True, chart_rect, \
359 proc_tree, None) 359 [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], \
360 # render CPU load 360 proc_tree, None)
361 draw_chart (ctx, CPU_COLOR, True, chart_rect, \ 361 # render CPU load
362 [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], \ 362 draw_chart (ctx, CPU_COLOR, True, chart_rect, \
363 proc_tree, None) 363 [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], \
364 364 proc_tree, None)
365 curr_y = curr_y + 30 + bar_h 365
366 curr_y = curr_y + 30 + bar_h
366 367
367 # render second chart 368 # render second chart
368 draw_legend_line(ctx, "Disk throughput", DISK_TPUT_COLOR, off_x, curr_y+20, leg_s) 369 if trace.disk_stats:
369 draw_legend_box(ctx, "Disk utilization", IO_COLOR, off_x + 120, curr_y+20, leg_s) 370 draw_legend_line(ctx, "Disk throughput", DISK_TPUT_COLOR, off_x, curr_y+20, leg_s)
370 371 draw_legend_box(ctx, "Disk utilization", IO_COLOR, off_x + 120, curr_y+20, leg_s)
371 # render I/O utilization 372
372 chart_rect = (off_x, curr_y+30, w, bar_h) 373 # render I/O utilization
373 if clip_visible (clip, chart_rect): 374 chart_rect = (off_x, curr_y+30, w, bar_h)
374 draw_box_ticks (ctx, chart_rect, sec_w) 375 if clip_visible (clip, chart_rect):
375 draw_annotations (ctx, proc_tree, trace.times, chart_rect) 376 draw_box_ticks (ctx, chart_rect, sec_w)
376 draw_chart (ctx, IO_COLOR, True, chart_rect, \ 377 draw_annotations (ctx, proc_tree, trace.times, chart_rect)
377 [(sample.time, sample.util) for sample in trace.disk_stats], \ 378 draw_chart (ctx, IO_COLOR, True, chart_rect, \
378 proc_tree, None) 379 [(sample.time, sample.util) for sample in trace.disk_stats], \
379 380 proc_tree, None)
380 # render disk throughput 381
381 max_sample = max (trace.disk_stats, key = lambda s: s.tput) 382 # render disk throughput
382 if clip_visible (clip, chart_rect): 383 max_sample = max (trace.disk_stats, key = lambda s: s.tput)
383 draw_chart (ctx, DISK_TPUT_COLOR, False, chart_rect, \ 384 if clip_visible (clip, chart_rect):
384 [(sample.time, sample.tput) for sample in trace.disk_stats], \ 385 draw_chart (ctx, DISK_TPUT_COLOR, False, chart_rect, \
385 proc_tree, None) 386 [(sample.time, sample.tput) for sample in trace.disk_stats], \
386 387 proc_tree, None)
387 pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) 388
388 389 pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration)
389 shift_x, shift_y = -20, 20 390
390 if (pos_x < off_x + 245): 391 shift_x, shift_y = -20, 20
391 shift_x, shift_y = 5, 40 392 if (pos_x < off_x + 245):
392 393 shift_x, shift_y = 5, 40
393 label = "%dMB/s" % round ((max_sample.tput) / 1024.0) 394
394 draw_text (ctx, label, DISK_TPUT_COLOR, pos_x + shift_x, curr_y + shift_y) 395 label = "%dMB/s" % round ((max_sample.tput) / 1024.0)
395 396 draw_text (ctx, label, DISK_TPUT_COLOR, pos_x + shift_x, curr_y + shift_y)
396 curr_y = curr_y + 30 + bar_h 397
398 curr_y = curr_y + 30 + bar_h
397 399
398 # render mem usage 400 # render mem usage
399 chart_rect = (off_x, curr_y+30, w, meminfo_bar_h) 401 chart_rect = (off_x, curr_y+30, w, meminfo_bar_h)