Skip to content

Commit 90c9cdf

Browse files
AlexanderSchultheissibbem
authored andcommitted
Updated plotting
1 parent fa3d16e commit 90c9cdf

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

plotting/plot.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ def commit_runtime(runtime_results: [], annotate=False):
2727
runtime_max = numpy.max(runtimes)
2828
runtimes = numpy.sort(runtimes)[::-1]
2929

30-
# Count how often the runtime is less than one minute, aka. our largest bin
31-
runtimes_below_one = [x for x in runtimes if x < 1]
32-
runtimes_below_one = len(runtimes_below_one)
30+
# Count how often the runtime is less than one second
31+
runtimes_below_one_second = len([x.runtime for x in runtime_results if x.runtime < 1000])
3332

3433
# For printing of commits with the greatest runtime
3534
# largest_commits = [x for x in runtime_results if x.runtime // 60000 == runtime_max]
@@ -55,17 +54,17 @@ def commit_runtime(runtime_results: [], annotate=False):
5554

5655
# Add annotation
5756
if annotate:
58-
percentage = 100 * runtimes_below_one / len(runtimes)
59-
ax.annotate(f'{runtimes_below_one:,.0f} commits require\nless than one minute ({percentage:,.2f}%).', xy=(0, runtimes_below_one),
57+
percentage = 100 * (runtimes_below_one_second / len(runtimes))
58+
ax.annotate(f'{runtimes_below_one_second:,.0f} commits require\nless than one second ({percentage:,.2f}%).', xy=(0, runtimes_below_one_second),
6059
xytext=(5, 40_000),
6160
arrowprops=dict(arrowstyle="->"),
6261
bbox=dict(boxstyle="round", fc="w"),
6362
fontsize=text_box_font_size
6463
)
6564

66-
percentage = 100 * runtime_max / len(runtimes)
65+
percentage = 100 * (runtime_max / len(runtimes))
6766
ax.annotate(f'Two commits require\n{runtime_max:,.0f} minutes ({percentage:,.2f}%).', xy=(runtime_max, 2),
68-
xytext=(runtime_max - 30, 10),
67+
xytext=(runtime_max - 35, 10),
6968
arrowprops=dict(arrowstyle="->"),
7069
bbox=dict(boxstyle="round", fc="w"),
7170
fontsize=text_box_font_size
@@ -89,5 +88,4 @@ def major_formatter(x, pos):
8988
results = load_runtime_results(folder)
9089
print("Plotting runtime histogram...")
9190
commit_runtime(results, True)
92-
# commit_runtime(results)
9391
print("Done.")

0 commit comments

Comments
 (0)