Skip to content

Commit

Permalink
[llvm-dwarfdump][Statistics] Change the coverage buckets representati…
Browse files Browse the repository at this point in the history
…on. 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
  • Loading branch information
chbessonova committed Dec 13, 2019
1 parent 25305a9 commit 1cc4b60
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 92 deletions.
24 changes: 12 additions & 12 deletions llvm/docs/CommandGuide/llvm-locstats.rst
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
120 changes: 60 additions & 60 deletions llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
Expand Up @@ -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:
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/tools/llvm-locstats/locstats.ll
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions llvm/tools/llvm-dwarfdump/Statistics.cpp
Expand Up @@ -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];
Expand Down
8 changes: 4 additions & 4 deletions llvm/utils/llvm-locstats/llvm-locstats.py
Expand Up @@ -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(
Expand All @@ -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 (' =================================================')
Expand Down

0 comments on commit 1cc4b60

Please sign in to comment.