[llvm] 1cc4b60 - [llvm-dwarfdump][Statistics] Change the coverage buckets representation. NFC

Kristina Bessonova via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 05:09:41 PST 2019


Author: Kristina Bessonova
Date: 2019-12-13T16:08:25+03:00
New Revision: 1cc4b603ba79c8bf8f60790cff31f872e7d00142

URL: https://github.com/llvm/llvm-project/commit/1cc4b603ba79c8bf8f60790cff31f872e7d00142
DIFF: https://github.com/llvm/llvm-project/commit/1cc4b603ba79c8bf8f60790cff31f872e7d00142.diff

LOG: [llvm-dwarfdump][Statistics] Change the coverage buckets representation. NFC

Summary:
This changes the representation of 'coverage buckets' in llvm-dwarfdump and
llvm-locstats to one that makes more clear what the buckets contain.

See some related details in D71070.

Reviewers: djtodoro, aprantl, cmtice, jhenderson

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71366

Added: 
    

Modified: 
    llvm/docs/CommandGuide/llvm-locstats.rst
    llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
    llvm/test/tools/llvm-locstats/locstats.ll
    llvm/tools/llvm-dwarfdump/Statistics.cpp
    llvm/utils/llvm-locstats/llvm-locstats.py

Removed: 
    


################################################################################
diff  --git a/llvm/docs/CommandGuide/llvm-locstats.rst b/llvm/docs/CommandGuide/llvm-locstats.rst
index 8b99917a1ff4..4f86522c9ed0 100644
--- a/llvm/docs/CommandGuide/llvm-locstats.rst
+++ b/llvm/docs/CommandGuide/llvm-locstats.rst
@@ -18,8 +18,8 @@ pretty printing it in a more human readable way.
 The line 0% shows the number and the percentage of DIEs with no location
 information, but the line 100% shows the information for DIEs where there is
 location information in all code section bytes (where the variable or parameter
-is in the scope). The line 50-59% shows the number and the percentage of DIEs
-where the location information is between 50 and 59 percentage of its scope
+is in the scope). The line [50%,60%) shows the number and the percentage of DIEs
+where the location information is between 50 and 60 percentage of its scope
 covered.
 
 OPTIONS
@@ -55,16 +55,16 @@ OUTPUT EXAMPLE
         cov%          samples       percentage(~)
   -------------------------------------------------
      0%                    1              16%
-     1-9%                  0               0%
-     10-19%                0               0%
-     20-29%                0               0%
-     30-39%                0               0%
-     40-49%                0               0%
-     50-59%                1              16%
-     60-69%                0               0%
-     70-79%                0               0%
-     80-89%                1              16%
-     90-99%                0               0%
+     [1%,10%)              0               0%
+     [10%,20%)             0               0%
+     [20%,30%)             0               0%
+     [30%,40%)             0               0%
+     [40%,50%)             0               0%
+     [50%,60%)             1              16%
+     [60%,70%)             0               0%
+     [70%,80%)             0               0%
+     [80%,90%)             1              16%
+     [90%,100%)            0               0%
      100%                  3              50%
   =================================================
   -the number of debug variables processed: 6

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll b/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
index e13d1b712787..598d1b79e13b 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
@@ -10,78 +10,78 @@
 ; CHECK: "vars entry value scope bytes covered":0
 ; CHECK: "total variables procesed by location statistics":6
 ; CHECK: "variables with 0% of its scope covered":1
-; CHECK: "variables with 1-9% of its scope covered":0
-; CHECK: "variables with 10-19% of its scope covered":0
-; CHECK: "variables with 20-29% of its scope covered":0
-; CHECK: "variables with 30-39% of its scope covered":0
-; CHECK: "variables with 40-49% of its scope covered":0
-; CHECK: "variables with 50-59% of its scope covered":1
-; CHECK: "variables with 60-69% of its scope covered":0
-; CHECK: "variables with 70-79% of its scope covered":0
-; CHECK: "variables with 80-89% of its scope covered":1
-; CHECK: "variables with 90-99% of its scope covered":0
+; CHECK: "variables with [1%,10%) of its scope covered":0
+; CHECK: "variables with [10%,20%) of its scope covered":0
+; CHECK: "variables with [20%,30%) of its scope covered":0
+; CHECK: "variables with [30%,40%) of its scope covered":0
+; CHECK: "variables with [40%,50%) of its scope covered":0
+; CHECK: "variables with [50%,60%) of its scope covered":1
+; CHECK: "variables with [60%,70%) of its scope covered":0
+; CHECK: "variables with [70%,80%) of its scope covered":0
+; CHECK: "variables with [80%,90%) of its scope covered":1
+; CHECK: "variables with [90%,100%) of its scope covered":0
 ; CHECK: "variables with 100% of its scope covered":3
 ; CHECK: "variables (excluding the debug entry values) with 0% of its scope covered":1
-; CHECK: "variables (excluding the debug entry values) with 1-9% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 10-19% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 20-29% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 30-39% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 40-49% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 50-59% of its scope covered":2
-; CHECK: "variables (excluding the debug entry values) with 60-69% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 70-79% of its scope covered":0
-; CHECK: "variables (excluding the debug entry values) with 80-89% of its scope covered":1
-; CHECK: "variables (excluding the debug entry values) with 90-99% of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [1%,10%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [10%,20%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [20%,30%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [30%,40%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [40%,50%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [50%,60%) of its scope covered":2
+; CHECK: "variables (excluding the debug entry values) with [60%,70%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [70%,80%) of its scope covered":0
+; CHECK: "variables (excluding the debug entry values) with [80%,90%) of its scope covered":1
+; CHECK: "variables (excluding the debug entry values) with [90%,100%) of its scope covered":0
 ; CHECK: "variables (excluding the debug entry values) with 100% of its scope covered":2
 ; CHECK: "total params procesed by location statistics":2
 ; CHECK: "params with 0% of its scope covered":0
-; CHECK: "params with 1-9% of its scope covered":0
-; CHECK: "params with 10-19% of its scope covered":0
-; CHECK: "params with 20-29% of its scope covered":0
-; CHECK: "params with 30-39% of its scope covered":0
-; CHECK: "params with 40-49% of its scope covered":0
-; CHECK: "params with 50-59% of its scope covered":0
-; CHECK: "params with 60-69% of its scope covered":0
-; CHECK: "params with 70-79% of its scope covered":0
-; CHECK: "params with 80-89% of its scope covered":0
-; CHECK: "params with 90-99% of its scope covered":0
+; CHECK: "params with [1%,10%) of its scope covered":0
+; CHECK: "params with [10%,20%) of its scope covered":0
+; CHECK: "params with [20%,30%) of its scope covered":0
+; CHECK: "params with [30%,40%) of its scope covered":0
+; CHECK: "params with [40%,50%) of its scope covered":0
+; CHECK: "params with [50%,60%) of its scope covered":0
+; CHECK: "params with [60%,70%) of its scope covered":0
+; CHECK: "params with [70%,80%) of its scope covered":0
+; CHECK: "params with [80%,90%) of its scope covered":0
+; CHECK: "params with [90%,100%) of its scope covered":0
 ; CHECK: "params with 100% of its scope covered":2
 ; CHECK: "params (excluding the debug entry values) with 0% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 1-9% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 10-19% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 20-29% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 30-39% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 40-49% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 50-59% of its scope covered":1
-; CHECK: "params (excluding the debug entry values) with 60-69% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 70-79% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 80-89% of its scope covered":0
-; CHECK: "params (excluding the debug entry values) with 90-99% of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [1%,10%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [10%,20%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [20%,30%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [30%,40%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [40%,50%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [50%,60%) of its scope covered":1
+; CHECK: "params (excluding the debug entry values) with [60%,70%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [70%,80%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [80%,90%) of its scope covered":0
+; CHECK: "params (excluding the debug entry values) with [90%,100%) of its scope covered":0
 ; CHECK: "params (excluding the debug entry values) with 100% of its scope covered":1
 ; CHECK: "total vars procesed by location statistics":4
 ; CHECK: "vars with 0% of its scope covered":1
-; CHECK: "vars with 1-9% of its scope covered":0
-; CHECK: "vars with 10-19% of its scope covered":0
-; CHECK: "vars with 20-29% of its scope covered":0
-; CHECK: "vars with 30-39% of its scope covered":0
-; CHECK: "vars with 40-49% of its scope covered":0
-; CHECK: "vars with 50-59% of its scope covered":1
-; CHECK: "vars with 60-69% of its scope covered":0
-; CHECK: "vars with 70-79% of its scope covered":0
-; CHECK: "vars with 80-89% of its scope covered":1
-; CHECK: "vars with 90-99% of its scope covered":0
+; CHECK: "vars with [1%,10%) of its scope covered":0
+; CHECK: "vars with [10%,20%) of its scope covered":0
+; CHECK: "vars with [20%,30%) of its scope covered":0
+; CHECK: "vars with [30%,40%) of its scope covered":0
+; CHECK: "vars with [40%,50%) of its scope covered":0
+; CHECK: "vars with [50%,60%) of its scope covered":1
+; CHECK: "vars with [60%,70%) of its scope covered":0
+; CHECK: "vars with [70%,80%) of its scope covered":0
+; CHECK: "vars with [80%,90%) of its scope covered":1
+; CHECK: "vars with [90%,100%) of its scope covered":0
 ; CHECK: "vars with 100% of its scope covered":1
 ; CHECK: "vars (excluding the debug entry values) with 0% of its scope covered":1
-; CHECK: "vars (excluding the debug entry values) with 1-9% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 10-19% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 20-29% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 30-39% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 40-49% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 50-59% of its scope covered":1
-; CHECK: "vars (excluding the debug entry values) with 60-69% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 70-79% of its scope covered":0
-; CHECK: "vars (excluding the debug entry values) with 80-89% of its scope covered":1
-; CHECK: "vars (excluding the debug entry values) with 90-99% of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [1%,10%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [10%,20%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [20%,30%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [30%,40%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [40%,50%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [50%,60%) of its scope covered":1
+; CHECK: "vars (excluding the debug entry values) with [60%,70%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [70%,80%) of its scope covered":0
+; CHECK: "vars (excluding the debug entry values) with [80%,90%) of its scope covered":1
+; CHECK: "vars (excluding the debug entry values) with [90%,100%) of its scope covered":0
 ; CHECK: "vars (excluding the debug entry values) with 100% of its scope covered":1
 ;
 ; The source code of the test case:

diff  --git a/llvm/test/tools/llvm-locstats/locstats.ll b/llvm/test/tools/llvm-locstats/locstats.ll
index 911abf5b711d..77621b24212a 100644
--- a/llvm/test/tools/llvm-locstats/locstats.ll
+++ b/llvm/test/tools/llvm-locstats/locstats.ll
@@ -5,16 +5,16 @@
 ;
 ; Test the llvm-locstats output.
 ; LOCSTATS: 0% 0 0%
-; LOCSTATS: 1-9% 0 0%
-; LOCSTATS: 10-19% 0 0%
-; LOCSTATS: 20-29% 1 11%
-; LOCSTATS: 30-39% 0 0%
-; LOCSTATS: 40-49% 1 11%
-; LOCSTATS: 50-59% 1 11%
-; LOCSTATS: 60-69% 0 0%
-; LOCSTATS: 70-79% 0 0%
-; LOCSTATS: 80-89% 3 33%
-; LOCSTATS: 90-99% 1 11%
+; LOCSTATS: [1%,10%) 0 0%
+; LOCSTATS: [10%,20%) 0 0%
+; LOCSTATS: [20%,30%) 1 11%
+; LOCSTATS: [30%,40%) 0 0%
+; LOCSTATS: [40%,50%) 1 11%
+; LOCSTATS: [50%,60%) 1 11%
+; LOCSTATS: [60%,70%) 0 0%
+; LOCSTATS: [70%,80%) 0 0%
+; LOCSTATS: [80%,90%) 3 33%
+; LOCSTATS: [90%,100%) 1 11%
 ; LOCSTATS: 100% 2 22%
 ;
 ; The source code of the test case:

diff  --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index fe45ff7d3fb7..2d0f30476e3e 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -430,16 +430,16 @@ static void printLocationStats(raw_ostream &OS,
      << LocationStats[0];
   LLVM_DEBUG(llvm::dbgs() << Key << " with 0% of its scope covered: "
                           << LocationStats[0] << '\n');
-  OS << ",\"" << Key << " with 1-9% of its scope covered\":"
+  OS << ",\"" << Key << " with [1%,10%) of its scope covered\":"
      << LocationStats[1];
-  LLVM_DEBUG(llvm::dbgs() << Key << " with 1-9% of its scope covered: "
+  LLVM_DEBUG(llvm::dbgs() << Key << " with [1%,10%) of its scope covered: "
                           << LocationStats[1] << '\n');
   for (unsigned i = 2; i < NumOfCoverageCategories - 1; ++i) {
-    OS << ",\"" << Key << " with " << (i - 1) * 10 << "-" << i * 10 - 1
-       << "% of its scope covered\":" << LocationStats[i];
+    OS << ",\"" << Key << " with [" << (i - 1) * 10 << "%," << i * 10
+       << "%) of its scope covered\":" << LocationStats[i];
     LLVM_DEBUG(llvm::dbgs()
-               << Key << " with " << (i - 1) * 10 << "-" << i * 10 - 1
-               << "% of its scope covered: " << LocationStats[i]);
+               << Key << " with [" << (i - 1) * 10 << "%," << i * 10
+               << "%) of its scope covered: " << LocationStats[i]);
   }
   OS << ",\"" << Key << " with 100% of its scope covered\":"
      << LocationStats[NumOfCoverageCategories - 1];

diff  --git a/llvm/utils/llvm-locstats/llvm-locstats.py b/llvm/utils/llvm-locstats/llvm-locstats.py
index 408513c31916..2bbc3f1986d8 100755
--- a/llvm/utils/llvm-locstats/llvm-locstats.py
+++ b/llvm/utils/llvm-locstats/llvm-locstats.py
@@ -15,9 +15,9 @@
 
 def coverage_buckets():
   yield '0%'
-  yield '1-9%'
+  yield '[1%,10%)'
   for start in range(10, 91, 10):
-    yield '{0}-{1}%'.format(start, start + 9)
+    yield '[{0}%,{1}%)'.format(start, start + 10)
   yield '100%'
 
 def locstats_output(
@@ -44,10 +44,10 @@ def locstats_output(
   print (' =================================================')
   print ('            Debug Location Statistics       ')
   print (' =================================================')
-  print ('     cov%          samples          percentage(~)  ')
+  print ('     cov%           samples         percentage(~)  ')
   print (' -------------------------------------------------')
   for cov_bucket in coverage_buckets():
-    print ('   {0:6}        {1:8d}             {2:3d}%'. \
+    print ('   {0:10}     {1:8d}              {2:3d}%'. \
       format(cov_bucket, variables_coverage_map[cov_bucket], \
              variables_coverage_per_map[cov_bucket]))
   print (' =================================================')


        


More information about the llvm-commits mailing list