mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 03:25:54 -04:00
[llvm-dwarfdump][Statistics] Don't count coverage less than 1% as 0%
Summary: This is a follow up for D70548. Currently, variables with debug info coverage between 0% and 1% are put into zero-bucket. D70548 changed the way statistics calculate a variable's coverage: we began to use enclosing scope rather than a possible variable life range. Thus more variables might be moved to zero-bucket despite they have some debug info coverage. The patch is to distinguish between a variable that has location info but it's significantly less than its enclosing scope and a variable that doesn't have it at all. Reviewers: djtodoro, aprantl, dblaikie, avl Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71070
This commit is contained in:
parent
97572775d2
commit
d5655c4d2e
@ -55,7 +55,7 @@ OUTPUT EXAMPLE
|
||||
cov% samples percentage(~)
|
||||
-------------------------------------------------
|
||||
0% 1 16%
|
||||
[1%,10%) 0 0%
|
||||
(0%,10%) 0 0%
|
||||
[10%,20%) 0 0%
|
||||
[20%,30%) 0 0%
|
||||
[30%,40%) 0 0%
|
||||
|
@ -10,7 +10,7 @@
|
||||
; 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%,10%) of its scope covered":0
|
||||
; CHECK: "variables with (0%,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
|
||||
@ -22,7 +22,7 @@
|
||||
; 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%,10%) of its scope covered":0
|
||||
; CHECK: "variables (excluding the debug entry values) with (0%,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
|
||||
@ -35,7 +35,7 @@
|
||||
; 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%,10%) of its scope covered":0
|
||||
; CHECK: "params with (0%,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
|
||||
@ -47,7 +47,7 @@
|
||||
; 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%,10%) of its scope covered":0
|
||||
; CHECK: "params (excluding the debug entry values) with (0%,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
|
||||
@ -60,7 +60,7 @@
|
||||
; 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%,10%) of its scope covered":0
|
||||
; CHECK: "vars with (0%,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
|
||||
@ -72,7 +72,7 @@
|
||||
; 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%,10%) of its scope covered":0
|
||||
; CHECK: "vars (excluding the debug entry values) with (0%,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
|
||||
|
@ -5,7 +5,7 @@
|
||||
;
|
||||
; Test the llvm-locstats output.
|
||||
; LOCSTATS: 0% 0 0%
|
||||
; LOCSTATS: [1%,10%) 0 0%
|
||||
; LOCSTATS: (0%,10%) 0 0%
|
||||
; LOCSTATS: [10%,20%) 0 0%
|
||||
; LOCSTATS: [20%,30%) 1 11%
|
||||
; LOCSTATS: [30%,40%) 0 0%
|
||||
|
@ -138,18 +138,16 @@ static void collectLocStats(uint64_t BytesCovered, uint64_t BytesInScope,
|
||||
std::vector<unsigned> &VarLocStats, bool IsParam,
|
||||
bool IsLocalVar) {
|
||||
auto getCoverageBucket = [BytesCovered, BytesInScope]() -> unsigned {
|
||||
unsigned LocBucket = 100 * (double)BytesCovered / BytesInScope;
|
||||
if (LocBucket == 0) {
|
||||
// No debug location at all for the variable.
|
||||
// No debug location at all for the variable.
|
||||
if (BytesCovered == 0)
|
||||
return 0;
|
||||
} else if (LocBucket == 100 || BytesCovered > BytesInScope) {
|
||||
// Fully covered variable within its scope.
|
||||
// Fully covered variable within its scope.
|
||||
if (BytesCovered >= BytesInScope)
|
||||
return NumOfCoverageCategories - 1;
|
||||
} else {
|
||||
// Get covered range (e.g. 20%-29%).
|
||||
LocBucket /= 10;
|
||||
return LocBucket + 1;
|
||||
}
|
||||
// Get covered range (e.g. 20%-29%).
|
||||
unsigned LocBucket = 100 * (double)BytesCovered / BytesInScope;
|
||||
LocBucket /= 10;
|
||||
return LocBucket + 1;
|
||||
};
|
||||
|
||||
unsigned CoverageBucket = getCoverageBucket();
|
||||
@ -430,9 +428,9 @@ 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%,10%) of its scope covered\":"
|
||||
OS << ",\"" << Key << " with (0%,10%) of its scope covered\":"
|
||||
<< LocationStats[1];
|
||||
LLVM_DEBUG(llvm::dbgs() << Key << " with [1%,10%) of its scope covered: "
|
||||
LLVM_DEBUG(llvm::dbgs() << Key << " with (0%,10%) of its scope covered: "
|
||||
<< LocationStats[1] << '\n');
|
||||
for (unsigned i = 2; i < NumOfCoverageCategories - 1; ++i) {
|
||||
OS << ",\"" << Key << " with [" << (i - 1) * 10 << "%," << i * 10
|
||||
|
@ -15,7 +15,7 @@ from subprocess import Popen, PIPE
|
||||
|
||||
def coverage_buckets():
|
||||
yield '0%'
|
||||
yield '[1%,10%)'
|
||||
yield '(0%,10%)'
|
||||
for start in range(10, 91, 10):
|
||||
yield '[{0}%,{1}%)'.format(start, start + 10)
|
||||
yield '100%'
|
||||
|
Loading…
Reference in New Issue
Block a user