[llvm] 3a7865d - [llvm-locstats] Fix labels on x-axis of comparison chart

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 10:04:28 PDT 2020


Author: Vedant Kumar
Date: 2020-04-01T10:04:01-07:00
New Revision: 3a7865df626c061fa72cb731f0af763254ed3beb

URL: https://github.com/llvm/llvm-project/commit/3a7865df626c061fa72cb731f0af763254ed3beb
DIFF: https://github.com/llvm/llvm-project/commit/3a7865df626c061fa72cb731f0af763254ed3beb.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/llvm-locstats/llvm-locstats.py b/llvm/utils/llvm-locstats/llvm-locstats.py
index 7b2f706fca94..dec87f9caf7d 100755
--- a/llvm/utils/llvm-locstats/llvm-locstats.py
+++ b/llvm/utils/llvm-locstats/llvm-locstats.py
@@ -121,14 +121,16 @@ def draw_location_
diff (self, locstats_to_compare):
     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,


        


More information about the llvm-commits mailing list