diff options
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/draw.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/draw.py | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py index a13df3a3fa..3926bdd11e 100644 --- a/scripts/pybootchartgui/pybootchartgui/draw.py +++ b/scripts/pybootchartgui/pybootchartgui/draw.py | |||
@@ -88,6 +88,10 @@ CPU_PRESSURE_TOTAL_COLOR = CPU_COLOR | |||
88 | IO_PRESSURE_AVG10_COLOR = (0.0, 0.0, 0.0, 1.0) | 88 | IO_PRESSURE_AVG10_COLOR = (0.0, 0.0, 0.0, 1.0) |
89 | # delta total IO pressure color | 89 | # delta total IO pressure color |
90 | IO_PRESSURE_TOTAL_COLOR = IO_COLOR | 90 | IO_PRESSURE_TOTAL_COLOR = IO_COLOR |
91 | # avg10 memory pressure color | ||
92 | MEM_PRESSURE_AVG10_COLOR = (0.0, 0.0, 0.0, 1.0) | ||
93 | # delta total memory pressure color | ||
94 | MEM_PRESSURE_TOTAL_COLOR = DISK_TPUT_COLOR | ||
91 | 95 | ||
92 | 96 | ||
93 | 97 | ||
@@ -460,12 +464,12 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
460 | 464 | ||
461 | curr_y = curr_y + 30 + bar_h | 465 | curr_y = curr_y + 30 + bar_h |
462 | 466 | ||
463 | # render delta total io | 467 | # render I/O pressure chart |
464 | if trace.io_pressure: | 468 | if trace.io_pressure: |
465 | draw_legend_line(ctx, "avg10 I/O Pressure", IO_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | 469 | draw_legend_line(ctx, "avg10 I/O Pressure", IO_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) |
466 | draw_legend_box(ctx, "delta total I/O Pressure", IO_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s) | 470 | draw_legend_box(ctx, "delta total I/O Pressure", IO_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s) |
467 | 471 | ||
468 | # render avg10 io | 472 | # render delta total io |
469 | chart_rect = (off_x, curr_y+30, w, bar_h) | 473 | chart_rect = (off_x, curr_y+30, w, bar_h) |
470 | if clip_visible (clip, chart_rect): | 474 | if clip_visible (clip, chart_rect): |
471 | draw_box_ticks (ctx, chart_rect, sec_w) | 475 | draw_box_ticks (ctx, chart_rect, sec_w) |
@@ -474,7 +478,7 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
474 | [(sample.time, sample.deltaTotal) for sample in trace.io_pressure], \ | 478 | [(sample.time, sample.deltaTotal) for sample in trace.io_pressure], \ |
475 | proc_tree, None) | 479 | proc_tree, None) |
476 | 480 | ||
477 | # render io pressure | 481 | # render avg10 io |
478 | max_sample = max (trace.io_pressure, key = lambda s: s.avg10) | 482 | max_sample = max (trace.io_pressure, key = lambda s: s.avg10) |
479 | if clip_visible (clip, chart_rect): | 483 | if clip_visible (clip, chart_rect): |
480 | draw_chart (ctx, IO_PRESSURE_AVG10_COLOR, False, chart_rect, \ | 484 | draw_chart (ctx, IO_PRESSURE_AVG10_COLOR, False, chart_rect, \ |
@@ -487,11 +491,45 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
487 | if (pos_x < off_x + 245): | 491 | if (pos_x < off_x + 245): |
488 | shift_x, shift_y = 5, 40 | 492 | shift_x, shift_y = 5, 40 |
489 | 493 | ||
494 | |||
490 | label = "%d%%" % (max_sample.avg10) | 495 | label = "%d%%" % (max_sample.avg10) |
491 | draw_text (ctx, label, IO_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) | 496 | draw_text (ctx, label, IO_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) |
492 | 497 | ||
493 | curr_y = curr_y + 30 + bar_h | 498 | curr_y = curr_y + 30 + bar_h |
494 | 499 | ||
500 | # render MEM pressure chart | ||
501 | if trace.mem_pressure: | ||
502 | draw_legend_line(ctx, "avg10 MEM Pressure", MEM_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | ||
503 | draw_legend_box(ctx, "delta total MEM Pressure", MEM_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s) | ||
504 | |||
505 | # render delta total mem | ||
506 | chart_rect = (off_x, curr_y+30, w, bar_h) | ||
507 | if clip_visible (clip, chart_rect): | ||
508 | draw_box_ticks (ctx, chart_rect, sec_w) | ||
509 | draw_annotations (ctx, proc_tree, trace.times, chart_rect) | ||
510 | draw_chart (ctx, MEM_PRESSURE_TOTAL_COLOR, True, chart_rect, \ | ||
511 | [(sample.time, sample.deltaTotal) for sample in trace.mem_pressure], \ | ||
512 | proc_tree, None) | ||
513 | |||
514 | # render avg10 mem | ||
515 | max_sample = max (trace.mem_pressure, key = lambda s: s.avg10) | ||
516 | if clip_visible (clip, chart_rect): | ||
517 | draw_chart (ctx, MEM_PRESSURE_AVG10_COLOR, False, chart_rect, \ | ||
518 | [(sample.time, sample.avg10) for sample in trace.mem_pressure], \ | ||
519 | proc_tree, None) | ||
520 | |||
521 | pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) | ||
522 | |||
523 | shift_x, shift_y = -20, 20 | ||
524 | if (pos_x < off_x + 245): | ||
525 | shift_x, shift_y = 5, 40 | ||
526 | |||
527 | |||
528 | label = "%d%%" % (max_sample.avg10) | ||
529 | draw_text (ctx, label, MEM_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) | ||
530 | |||
531 | curr_y = curr_y + 30 + bar_h | ||
532 | |||
495 | # render disk space usage | 533 | # render disk space usage |
496 | # | 534 | # |
497 | # Draws the amount of disk space used on each volume relative to the | 535 | # Draws the amount of disk space used on each volume relative to the |