[PATCH] D77155: [llvm-locstats] Fix labels on x-axis of comparison chart

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 11:26:23 PDT 2020


vsk created this revision.
vsk added a reviewer: djtodoro.
Herald added a project: LLVM.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77155

Files:
  llvm/utils/llvm-locstats/llvm-locstats.py


Index: llvm/utils/llvm-locstats/llvm-locstats.py
===================================================================
--- llvm/utils/llvm-locstats/llvm-locstats.py
+++ 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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77155.253932.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200331/9ba2bb83/attachment.bin>


More information about the llvm-commits mailing list