power-report: rename comparison graph to power-thermal-compare.png; trim legend
Drops the before/after naming and the CPU name dump from the title; legend and labels are shortened with a 'machine' legend title.
This commit is contained in:
parent
a2475a1ba3
commit
14a6c4c0d0
1 changed files with 11 additions and 7 deletions
|
|
@ -222,6 +222,12 @@ def main():
|
|||
if len(args.tags) > 1:
|
||||
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(11, 7), sharex=True)
|
||||
palette = ("#c0392b", "#2980b9", "#27ae60", "#8e44ad", "#d35400", "#16a085")
|
||||
# Keep legend/labels short: shorten the on-plot names and drop the
|
||||
# per-machine CPU names (they go in the printed summary, not the chart).
|
||||
def short(t):
|
||||
s = labels.get(t) or t
|
||||
s = s.replace("-headless", "").replace("_", " ")
|
||||
return s if len(s) <= 16 else s[:15] + "…"
|
||||
for i, tag in enumerate(args.tags):
|
||||
color = palette[i % len(palette)]
|
||||
d = data[tag]
|
||||
|
|
@ -229,21 +235,19 @@ def main():
|
|||
continue
|
||||
t0 = d["pkg"][0][0]
|
||||
pts = [((t - t0) / 60, v) for t, v in d["pkg"] if v is not None]
|
||||
ax1.plot([p[0] for p in pts], [p[1] for p in pts], label=label(tag), color=color, lw=1)
|
||||
ax1.plot([p[0] for p in pts], [p[1] for p in pts], label=short(tag), color=color, lw=1)
|
||||
tt = [((t - t0) / 60, v) for t, v in d["temp"] if v is not None]
|
||||
if tt:
|
||||
ax2.plot([p[0] for p in tt], [p[1] for p in tt], label=label(tag), color=color, lw=1)
|
||||
ax2.plot([p[0] for p in tt], [p[1] for p in tt], label=short(tag), color=color, lw=1)
|
||||
ax1.set_ylabel("package W")
|
||||
ax1.legend(fontsize=8)
|
||||
cpus = [data[t]["cpu"] for t in args.tags if data[t]["cpu"]]
|
||||
cpu_note = " | ".join(dict.fromkeys(cpus)) if cpus else "unknown CPU"
|
||||
ax1.set_title(f"package power & CPU temp — {len(args.tags)} runs\nCPUs: {cpu_note}")
|
||||
ax1.legend(fontsize=8, title="machine", title_fontsize=8)
|
||||
ax1.set_title(f"package power & CPU temp — {len(args.tags)} machines")
|
||||
ax1.grid(alpha=0.3)
|
||||
ax2.set_ylabel("CPU temp (°C)")
|
||||
ax2.set_xlabel("minutes from start")
|
||||
ax2.legend(fontsize=8)
|
||||
ax2.grid(alpha=0.3)
|
||||
out = os.path.join(GRAPHS, "compare-before-after.png")
|
||||
out = os.path.join(GRAPHS, "power-thermal-compare.png")
|
||||
fig.tight_layout()
|
||||
fig.savefig(out, dpi=110)
|
||||
plt.close(fig)
|
||||
|
|
|
|||
Loading…
Reference in a new issue