[llvm-locstats] Fix labels on x-axis of comparison chart
Summary:
This change makes the labels on the x-axis of a comparison chart look
like: "0%", "(0%, 10%)", "[10%, 20%)", and so on.
Previously, each label was the same (a concatenation of all the possible
coverage buckets).
Reviewers: djtodoro
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77155
diff --git a/llvm/utils/llvm-locstats/llvm-locstats.py b/llvm/utils/llvm-locstats/llvm-locstats.py
index 7b2f706..dec87f9 100755
--- a/llvm/utils/llvm-locstats/llvm-locstats.py
+++ b/llvm/utils/llvm-locstats/llvm-locstats.py
@@ -121,14 +121,16 @@
ax = fig.add_subplot(111)
init_plot(plt)
+ comparison_keys = list(coverage_buckets())
ax.bar(buckets, self.variables_coverage_map.values(), align='edge',
- tick_label=self.variables_coverage_map.keys(), width=0.4,
+ width=0.4,
label='variables of {}'.format(self.file_name))
ax.bar(buckets_to_compare,
locstats_to_compare.variables_coverage_map.values(),
color='r', align='edge', width=-0.4,
- tick_label=locstats_to_compare.variables_coverage_map.keys(),
label='variables of {}'.format(locstats_to_compare.file_name))
+ ax.set_xticks(range(len(comparison_keys)))
+ ax.set_xticklabels(comparison_keys)
props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
plt.text(0.02, 0.88,