summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2022-08-02 21:11:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-04 16:27:25 +0100
commit6e756b150a24609ae41e42e607b7faed80d3eb54 (patch)
tree020a7981f2697c61ca748b084a5b17f9da6379c0 /scripts/pybootchartgui
parent096f688ec0d9cd5c9a54644bdf82aac0aca959a5 (diff)
downloadpoky-6e756b150a24609ae41e42e607b7faed80d3eb54.tar.gz
pybootchartgui: render memory pressure as well
* memory pressure is already collected in buildstats, render it as well when available (From OE-Core rev: 42010d0812246a418f30b4f1d9fbd3f374a3bbe9) Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/draw.py44
-rw-r--r--scripts/pybootchartgui/pybootchartgui/parsing.py5
-rw-r--r--scripts/pybootchartgui/pybootchartgui/samples.py8
3 files changed, 54 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
88IO_PRESSURE_AVG10_COLOR = (0.0, 0.0, 0.0, 1.0) 88IO_PRESSURE_AVG10_COLOR = (0.0, 0.0, 0.0, 1.0)
89# delta total IO pressure color 89# delta total IO pressure color
90IO_PRESSURE_TOTAL_COLOR = IO_COLOR 90IO_PRESSURE_TOTAL_COLOR = IO_COLOR
91# avg10 memory pressure color
92MEM_PRESSURE_AVG10_COLOR = (0.0, 0.0, 0.0, 1.0)
93# delta total memory pressure color
94MEM_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
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index 004d6fb953..362d5153e8 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -51,6 +51,7 @@ class Trace:
51 self.monitor_disk = None 51 self.monitor_disk = None
52 self.cpu_pressure = [] 52 self.cpu_pressure = []
53 self.io_pressure = [] 53 self.io_pressure = []
54 self.mem_pressure = []
54 self.times = [] # Always empty, but expected by draw.py when drawing system charts. 55 self.times = [] # Always empty, but expected by draw.py when drawing system charts.
55 56
56 if len(paths): 57 if len(paths):
@@ -564,6 +565,8 @@ def _parse_pressure_logs(file, filename):
564 pressure_stats = [] 565 pressure_stats = []
565 if filename == "cpu.log": 566 if filename == "cpu.log":
566 SamplingClass = CPUPressureSample 567 SamplingClass = CPUPressureSample
568 elif filename == "memory.log":
569 SamplingClass = MemPressureSample
567 else: 570 else:
568 SamplingClass = IOPressureSample 571 SamplingClass = IOPressureSample
569 for time, lines in _parse_timed_blocks(file): 572 for time, lines in _parse_timed_blocks(file):
@@ -769,6 +772,8 @@ def _do_parse(writer, state, filename, file):
769 state.cpu_pressure = _parse_pressure_logs(file, name) 772 state.cpu_pressure = _parse_pressure_logs(file, name)
770 elif name == "io.log": 773 elif name == "io.log":
771 state.io_pressure = _parse_pressure_logs(file, name) 774 state.io_pressure = _parse_pressure_logs(file, name)
775 elif name == "memory.log":
776 state.mem_pressure = _parse_pressure_logs(file, name)
772 elif not filename.endswith('.log'): 777 elif not filename.endswith('.log'):
773 _parse_bitbake_buildstats(writer, state, filename, file) 778 _parse_bitbake_buildstats(writer, state, filename, file)
774 t2 = time.process_time() 779 t2 = time.process_time()
diff --git a/scripts/pybootchartgui/pybootchartgui/samples.py b/scripts/pybootchartgui/pybootchartgui/samples.py
index 472dc27be0..a70d8a5a28 100644
--- a/scripts/pybootchartgui/pybootchartgui/samples.py
+++ b/scripts/pybootchartgui/pybootchartgui/samples.py
@@ -53,6 +53,14 @@ class IOPressureSample:
53 self.avg300 = avg300 53 self.avg300 = avg300
54 self.deltaTotal = deltaTotal 54 self.deltaTotal = deltaTotal
55 55
56class MemPressureSample:
57 def __init__(self, time, avg10, avg60, avg300, deltaTotal):
58 self.time = time
59 self.avg10 = avg10
60 self.avg60 = avg60
61 self.avg300 = avg300
62 self.deltaTotal = deltaTotal
63
56 64
57class MemSample: 65class MemSample:
58 used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',) 66 used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',)