diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/draw.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py index 4e04b06427..4326361426 100644 --- a/scripts/pybootchartgui/pybootchartgui/draw.py +++ b/scripts/pybootchartgui/pybootchartgui/draw.py | |||
@@ -433,8 +433,10 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
433 | 433 | ||
434 | # render CPU pressure chart | 434 | # render CPU pressure chart |
435 | if trace.cpu_pressure: | 435 | if trace.cpu_pressure: |
436 | draw_legend_line(ctx, "avg10 CPU Pressure", CPU_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | 436 | max_sample_avg = max (trace.cpu_pressure, key = lambda s: s.avg10) |
437 | draw_legend_box(ctx, "delta total CPU Pressure", CPU_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s) | 437 | max_sample_total = max (trace.cpu_pressure, key = lambda s: s.deltaTotal) |
438 | draw_legend_line(ctx, "avg10 CPU Pressure (max %d%%)" % (max_sample_avg.avg10), CPU_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | ||
439 | draw_legend_box(ctx, "delta total CPU Pressure (max %d)" % (max_sample_total.deltaTotal), CPU_PRESSURE_TOTAL_COLOR, off_x + 240, curr_y+20, leg_s) | ||
438 | 440 | ||
439 | # render delta total cpu | 441 | # render delta total cpu |
440 | chart_rect = (off_x, curr_y+30, w, bar_h) | 442 | chart_rect = (off_x, curr_y+30, w, bar_h) |
@@ -446,28 +448,29 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
446 | proc_tree, None) | 448 | proc_tree, None) |
447 | 449 | ||
448 | # render avg10 cpu | 450 | # render avg10 cpu |
449 | max_sample = max (trace.cpu_pressure, key = lambda s: s.avg10) | ||
450 | if clip_visible (clip, chart_rect): | 451 | if clip_visible (clip, chart_rect): |
451 | draw_chart (ctx, CPU_PRESSURE_AVG10_COLOR, False, chart_rect, \ | 452 | draw_chart (ctx, CPU_PRESSURE_AVG10_COLOR, False, chart_rect, \ |
452 | [(sample.time, sample.avg10) for sample in trace.cpu_pressure], \ | 453 | [(sample.time, sample.avg10) for sample in trace.cpu_pressure], \ |
453 | proc_tree, None) | 454 | proc_tree, None) |
454 | 455 | ||
455 | pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) | 456 | pos_x = off_x + ((max_sample_avg.time - proc_tree.start_time) * w / proc_tree.duration) |
456 | 457 | ||
457 | shift_x, shift_y = -20, 20 | 458 | shift_x, shift_y = -20, 20 |
458 | if (pos_x < off_x + 245): | 459 | if (pos_x < off_x + 245): |
459 | shift_x, shift_y = 5, 40 | 460 | shift_x, shift_y = 5, 40 |
460 | 461 | ||
461 | 462 | ||
462 | label = "%d%%" % (max_sample.avg10) | 463 | label = "%d%%" % (max_sample_avg.avg10) |
463 | draw_text (ctx, label, CPU_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) | 464 | draw_text (ctx, label, CPU_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) |
464 | 465 | ||
465 | curr_y = curr_y + 30 + bar_h | 466 | curr_y = curr_y + 30 + bar_h |
466 | 467 | ||
467 | # render I/O pressure chart | 468 | # render I/O pressure chart |
468 | if trace.io_pressure: | 469 | if trace.io_pressure: |
469 | draw_legend_line(ctx, "avg10 I/O Pressure", IO_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | 470 | max_sample_avg = max (trace.io_pressure, key = lambda s: s.avg10) |
470 | draw_legend_box(ctx, "delta total I/O Pressure", IO_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s) | 471 | max_sample_total = max (trace.io_pressure, key = lambda s: s.deltaTotal) |
472 | draw_legend_line(ctx, "avg10 I/O Pressure (max %d%%)" % (max_sample_avg.avg10), IO_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | ||
473 | draw_legend_box(ctx, "delta total I/O Pressure (max %d)" % (max_sample_total.deltaTotal), IO_PRESSURE_TOTAL_COLOR, off_x + 240, curr_y+20, leg_s) | ||
471 | 474 | ||
472 | # render delta total io | 475 | # render delta total io |
473 | chart_rect = (off_x, curr_y+30, w, bar_h) | 476 | chart_rect = (off_x, curr_y+30, w, bar_h) |
@@ -479,28 +482,29 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
479 | proc_tree, None) | 482 | proc_tree, None) |
480 | 483 | ||
481 | # render avg10 io | 484 | # render avg10 io |
482 | max_sample = max (trace.io_pressure, key = lambda s: s.avg10) | ||
483 | if clip_visible (clip, chart_rect): | 485 | if clip_visible (clip, chart_rect): |
484 | draw_chart (ctx, IO_PRESSURE_AVG10_COLOR, False, chart_rect, \ | 486 | draw_chart (ctx, IO_PRESSURE_AVG10_COLOR, False, chart_rect, \ |
485 | [(sample.time, sample.avg10) for sample in trace.io_pressure], \ | 487 | [(sample.time, sample.avg10) for sample in trace.io_pressure], \ |
486 | proc_tree, None) | 488 | proc_tree, None) |
487 | 489 | ||
488 | pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) | 490 | pos_x = off_x + ((max_sample_avg.time - proc_tree.start_time) * w / proc_tree.duration) |
489 | 491 | ||
490 | shift_x, shift_y = -20, 20 | 492 | shift_x, shift_y = -20, 20 |
491 | if (pos_x < off_x + 245): | 493 | if (pos_x < off_x + 245): |
492 | shift_x, shift_y = 5, 40 | 494 | shift_x, shift_y = 5, 40 |
493 | 495 | ||
494 | 496 | ||
495 | label = "%d%%" % (max_sample.avg10) | 497 | label = "%d%%" % (max_sample_avg.avg10) |
496 | draw_text (ctx, label, IO_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) | 498 | draw_text (ctx, label, IO_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) |
497 | 499 | ||
498 | curr_y = curr_y + 30 + bar_h | 500 | curr_y = curr_y + 30 + bar_h |
499 | 501 | ||
500 | # render MEM pressure chart | 502 | # render MEM pressure chart |
501 | if trace.mem_pressure: | 503 | if trace.mem_pressure: |
502 | draw_legend_line(ctx, "avg10 MEM Pressure", MEM_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | 504 | max_sample_avg = max (trace.mem_pressure, key = lambda s: s.avg10) |
503 | draw_legend_box(ctx, "delta total MEM Pressure", MEM_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s) | 505 | max_sample_total = max (trace.mem_pressure, key = lambda s: s.deltaTotal) |
506 | draw_legend_line(ctx, "avg10 MEM Pressure (max %d%%)" % (max_sample_avg.avg10), MEM_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s) | ||
507 | draw_legend_box(ctx, "delta total MEM Pressure (max %d)" % (max_sample_total.deltaTotal), MEM_PRESSURE_TOTAL_COLOR, off_x + 240, curr_y+20, leg_s) | ||
504 | 508 | ||
505 | # render delta total mem | 509 | # render delta total mem |
506 | chart_rect = (off_x, curr_y+30, w, bar_h) | 510 | chart_rect = (off_x, curr_y+30, w, bar_h) |
@@ -512,20 +516,19 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
512 | proc_tree, None) | 516 | proc_tree, None) |
513 | 517 | ||
514 | # render avg10 mem | 518 | # render avg10 mem |
515 | max_sample = max (trace.mem_pressure, key = lambda s: s.avg10) | ||
516 | if clip_visible (clip, chart_rect): | 519 | if clip_visible (clip, chart_rect): |
517 | draw_chart (ctx, MEM_PRESSURE_AVG10_COLOR, False, chart_rect, \ | 520 | draw_chart (ctx, MEM_PRESSURE_AVG10_COLOR, False, chart_rect, \ |
518 | [(sample.time, sample.avg10) for sample in trace.mem_pressure], \ | 521 | [(sample.time, sample.avg10) for sample in trace.mem_pressure], \ |
519 | proc_tree, None) | 522 | proc_tree, None) |
520 | 523 | ||
521 | pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration) | 524 | pos_x = off_x + ((max_sample_avg.time - proc_tree.start_time) * w / proc_tree.duration) |
522 | 525 | ||
523 | shift_x, shift_y = -20, 20 | 526 | shift_x, shift_y = -20, 20 |
524 | if (pos_x < off_x + 245): | 527 | if (pos_x < off_x + 245): |
525 | shift_x, shift_y = 5, 40 | 528 | shift_x, shift_y = 5, 40 |
526 | 529 | ||
527 | 530 | ||
528 | label = "%d%%" % (max_sample.avg10) | 531 | label = "%d%%" % (max_sample_avg.avg10) |
529 | draw_text (ctx, label, MEM_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) | 532 | draw_text (ctx, label, MEM_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y) |
530 | 533 | ||
531 | curr_y = curr_y + 30 + bar_h | 534 | curr_y = curr_y + 30 + bar_h |