Skip to content

Commit b1fae59

Browse files
committed
Small improvements in charts script
1 parent de8aa5e commit b1fae59

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

bin/create_charts.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,26 @@ def create_charts(test_results):
3535
workload_results[result['workload']] = []
3636
workload_results[result['workload']].append(result)
3737

38-
for name, results in workload_results.items():
39-
print 'Generating charts for', name
38+
for workload, results in workload_results.items():
39+
print 'Generating charts for', workload
40+
workload = workload.replace('/', '-')
4041

41-
create_chart('Publish latency 99pct',
42+
create_chart(workload, 'Publish latency 99pct',
4243
y_label='Latency (ms)',
4344
time_series=[(x['driver'], x['publishLatency99pct']) for x in results])
4445

45-
create_chart('Publish rate',
46+
create_chart(workload, 'Publish rate',
4647
y_label='Rate (msg/s)',
4748
time_series=[(x['driver'], x['publishRate']) for x in results])
4849

49-
create_quantile_chart('Publish latency quantiles',
50+
create_quantile_chart(workload, 'Publish latency quantiles',
5051
y_label='Latency (ms)',
5152
time_series=[(x['driver'], x['aggregatedPublishLatencyQuantiles']) for x in results])
5253

5354

54-
def create_chart(title, y_label, time_series):
55-
chart = pygal.XY()
55+
def create_chart(workload, title, y_label, time_series):
56+
chart = pygal.XY(dots_size=.3,
57+
legend_at_bottom=True,)
5658
chart.title = title
5759

5860
chart.human_readable = True
@@ -64,10 +66,10 @@ def create_chart(title, y_label, time_series):
6466
chart.add(label, [(10*x, y) for x, y in enumerate(values)])
6567

6668
chart.range = (0, max(chain(* [l for (x, l) in time_series])) * 1.20)
67-
chart.render_to_file(title + '.svg')
69+
chart.render_to_file('%s - %s.svg' % (workload, title))
6870

6971

70-
def create_quantile_chart(title, y_label, time_series):
72+
def create_quantile_chart(workload, title, y_label, time_series):
7173
import math
7274
chart = pygal.XY( # style=pygal.style.LightColorizedStyle,
7375
# fill=True,
@@ -89,7 +91,7 @@ def create_quantile_chart(title, y_label, time_series):
8991
xy_values = [(math.log10(100 / (100 - x)), y) for x, y in values if x <= 99.999]
9092
chart.add(label, xy_values)
9193

92-
chart.render_to_file('%s.svg' % title)
94+
chart.render_to_file('%s - %s.svg' % (workload, title))
9395

9496

9597
if __name__ == '__main__':

0 commit comments

Comments
 (0)