* [PATCH 1/2] pybootchartgui: fix 2 SyntaxWarnings
[not found] <17079CEA61EEB51A.26827@lists.openembedded.org>
@ 2022-08-03 15:12 ` Martin Jansa
2022-08-03 15:12 ` [PATCH 2/2] pybootchartgui: write the max values in the graph legend Martin Jansa
0 siblings, 1 reply; 2+ messages in thread
From: Martin Jansa @ 2022-08-03 15:12 UTC (permalink / raw)
To: openembedded-core; +Cc: Aryaman Gupta, Randy MacLeod, Martin Jansa
scripts/pybootchartgui/pybootchartgui/draw.py:820: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if (OPTIONS.show_pid or OPTIONS.show_all) and ipid is not 0:
scripts/pybootchartgui/pybootchartgui/draw.py:918: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if i is not 0:
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
scripts/pybootchartgui/pybootchartgui/draw.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py
index 3926bdd11e..4e04b06427 100644
--- a/scripts/pybootchartgui/pybootchartgui/draw.py
+++ b/scripts/pybootchartgui/pybootchartgui/draw.py
@@ -813,7 +813,7 @@ def draw_processes_recursively(ctx, proc, proc_tree, y, proc_h, rect, clip) :
cmdString = proc.cmd
else:
cmdString = ''
- if (OPTIONS.show_pid or OPTIONS.show_all) and ipid is not 0:
+ if (OPTIONS.show_pid or OPTIONS.show_all) and ipid != 0:
cmdString = cmdString + " [" + str(ipid // 1000) + "]"
if OPTIONS.show_all:
if proc.args:
@@ -911,7 +911,7 @@ class CumlSample:
if self.color is None:
i = self.next() % HSV_MAX_MOD
h = 0.0
- if i is not 0:
+ if i != 0:
h = (1.0 * i) / HSV_MAX_MOD
s = 0.5
v = 1.0
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] pybootchartgui: write the max values in the graph legend
2022-08-03 15:12 ` [PATCH 1/2] pybootchartgui: fix 2 SyntaxWarnings Martin Jansa
@ 2022-08-03 15:12 ` Martin Jansa
0 siblings, 0 replies; 2+ messages in thread
From: Martin Jansa @ 2022-08-03 15:12 UTC (permalink / raw)
To: openembedded-core; +Cc: Aryaman Gupta, Randy MacLeod, Martin Jansa
* easier to find than searching for the highest value in the graph, when the graph is really wide
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
scripts/pybootchartgui/pybootchartgui/draw.py | 33 ++++++++++---------
1 file 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):
# render CPU pressure chart
if trace.cpu_pressure:
- draw_legend_line(ctx, "avg10 CPU Pressure", CPU_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s)
- draw_legend_box(ctx, "delta total CPU Pressure", CPU_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s)
+ max_sample_avg = max (trace.cpu_pressure, key = lambda s: s.avg10)
+ max_sample_total = max (trace.cpu_pressure, key = lambda s: s.deltaTotal)
+ draw_legend_line(ctx, "avg10 CPU Pressure (max %d%%)" % (max_sample_avg.avg10), CPU_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s)
+ 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)
# render delta total cpu
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):
proc_tree, None)
# render avg10 cpu
- max_sample = max (trace.cpu_pressure, key = lambda s: s.avg10)
if clip_visible (clip, chart_rect):
draw_chart (ctx, CPU_PRESSURE_AVG10_COLOR, False, chart_rect, \
[(sample.time, sample.avg10) for sample in trace.cpu_pressure], \
proc_tree, None)
- pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration)
+ pos_x = off_x + ((max_sample_avg.time - proc_tree.start_time) * w / proc_tree.duration)
shift_x, shift_y = -20, 20
if (pos_x < off_x + 245):
shift_x, shift_y = 5, 40
- label = "%d%%" % (max_sample.avg10)
+ label = "%d%%" % (max_sample_avg.avg10)
draw_text (ctx, label, CPU_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y)
curr_y = curr_y + 30 + bar_h
# render I/O pressure chart
if trace.io_pressure:
- draw_legend_line(ctx, "avg10 I/O Pressure", IO_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s)
- draw_legend_box(ctx, "delta total I/O Pressure", IO_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s)
+ max_sample_avg = max (trace.io_pressure, key = lambda s: s.avg10)
+ max_sample_total = max (trace.io_pressure, key = lambda s: s.deltaTotal)
+ 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)
+ 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)
# render delta total io
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):
proc_tree, None)
# render avg10 io
- max_sample = max (trace.io_pressure, key = lambda s: s.avg10)
if clip_visible (clip, chart_rect):
draw_chart (ctx, IO_PRESSURE_AVG10_COLOR, False, chart_rect, \
[(sample.time, sample.avg10) for sample in trace.io_pressure], \
proc_tree, None)
- pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration)
+ pos_x = off_x + ((max_sample_avg.time - proc_tree.start_time) * w / proc_tree.duration)
shift_x, shift_y = -20, 20
if (pos_x < off_x + 245):
shift_x, shift_y = 5, 40
- label = "%d%%" % (max_sample.avg10)
+ label = "%d%%" % (max_sample_avg.avg10)
draw_text (ctx, label, IO_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y)
curr_y = curr_y + 30 + bar_h
# render MEM pressure chart
if trace.mem_pressure:
- draw_legend_line(ctx, "avg10 MEM Pressure", MEM_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s)
- draw_legend_box(ctx, "delta total MEM Pressure", MEM_PRESSURE_TOTAL_COLOR, off_x + 140, curr_y+20, leg_s)
+ max_sample_avg = max (trace.mem_pressure, key = lambda s: s.avg10)
+ max_sample_total = max (trace.mem_pressure, key = lambda s: s.deltaTotal)
+ draw_legend_line(ctx, "avg10 MEM Pressure (max %d%%)" % (max_sample_avg.avg10), MEM_PRESSURE_AVG10_COLOR, off_x, curr_y+20, leg_s)
+ 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)
# render delta total mem
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):
proc_tree, None)
# render avg10 mem
- max_sample = max (trace.mem_pressure, key = lambda s: s.avg10)
if clip_visible (clip, chart_rect):
draw_chart (ctx, MEM_PRESSURE_AVG10_COLOR, False, chart_rect, \
[(sample.time, sample.avg10) for sample in trace.mem_pressure], \
proc_tree, None)
- pos_x = off_x + ((max_sample.time - proc_tree.start_time) * w / proc_tree.duration)
+ pos_x = off_x + ((max_sample_avg.time - proc_tree.start_time) * w / proc_tree.duration)
shift_x, shift_y = -20, 20
if (pos_x < off_x + 245):
shift_x, shift_y = 5, 40
- label = "%d%%" % (max_sample.avg10)
+ label = "%d%%" % (max_sample_avg.avg10)
draw_text (ctx, label, MEM_PRESSURE_AVG10_COLOR, pos_x + shift_x, curr_y + shift_y)
curr_y = curr_y + 30 + bar_h
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-03 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <17079CEA61EEB51A.26827@lists.openembedded.org>
2022-08-03 15:12 ` [PATCH 1/2] pybootchartgui: fix 2 SyntaxWarnings Martin Jansa
2022-08-03 15:12 ` [PATCH 2/2] pybootchartgui: write the max values in the graph legend Martin Jansa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox