contrib: update window title when possible in perf-revlog-write-plot.py
This is useful when comparing multiple graphs.
--- a/contrib/perf-utils/perf-revlog-write-plot.py Fri Jan 11 12:40:16 2019 -0800
+++ b/contrib/perf-utils/perf-revlog-write-plot.py Thu Jan 03 22:13:28 2019 +0100
@@ -22,7 +22,7 @@
)
-def plot(data):
+def plot(data, title=None):
items = {}
re_title = re.compile(r'^revisions #\d+ of \d+, rev (\d+)$')
for item in data:
@@ -108,6 +108,8 @@
else:
legline.set_alpha(0.2)
fig.canvas.draw()
+ if title is not None:
+ fig.canvas.set_window_title(title)
fig.canvas.mpl_connect('pick_event', onpick)
plt.show()
@@ -119,7 +121,7 @@
if len(sys.argv) > 1:
print('reading from %r' % sys.argv[1])
with open(sys.argv[1], 'r') as fp:
- plot(json.load(fp))
+ plot(json.load(fp), title=sys.argv[1])
else:
print('reading from stdin')
plot(json.load(sys.stdin))