Skip to content

Commit 89647e9

Browse files
committed
refactor: replace CPUSample.getValue(1) with CPUSample.getTime()
1 parent 076c869 commit 89647e9

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

qlsrc/pprof_ext/cpuprofile.qll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class CPUProfile extends Profile {
3535
* Sum of all sample values at index 1 (total time in nanoseconds).
3636
*/
3737
QlBuiltins::BigInt sampleTimeSum() {
38-
result = sum(Sample sample
38+
result = sum(CPUSample sample
3939
| super.getSample(_) = sample
40-
| sample.getValue(1)
40+
| sample.getTime()
4141
)
4242
}
4343

@@ -46,10 +46,10 @@ class CPUProfile extends Profile {
4646
*/
4747
bindingset[funcFullName]
4848
QlBuiltins::BigInt cumTimeOfFunc(string funcFullName) {
49-
result = sum(Sample sample
49+
result = sum(CPUSample sample
5050
| super.getSample(_) = sample and
5151
sample.containsFunc(funcFullName)
52-
| sample.getValue(1) // time is at index 1
52+
| sample.getTime()
5353
)
5454
}
5555

@@ -60,11 +60,11 @@ class CPUProfile extends Profile {
6060
*/
6161
bindingset[funcFullName]
6262
QlBuiltins::BigInt flatTimeOfFunc(string funcFullName) {
63-
result = sum(Sample sample
63+
result = sum(CPUSample sample
6464
| super.getSample(_) = sample and
6565
sample.containsFunc(funcFullName) and
6666
sample.getLocation(0).getLine(_).getFunction().getName() = funcFullName
67-
| sample.getValue(1) // time is at index 1
67+
| sample.getTime()
6868
)
6969
}
7070

@@ -73,10 +73,10 @@ class CPUProfile extends Profile {
7373
*/
7474
bindingset[funcFullName, lineNumber]
7575
QlBuiltins::BigInt cumTimeOfLine(string funcFullName, int lineNumber) {
76-
result = sum(Sample sample
76+
result = sum(CPUSample sample
7777
| super.getSample(_) = sample and
7878
sample.containsLine(funcFullName, lineNumber)
79-
| sample.getValue(1) // time is at index 1
79+
| sample.getTime()
8080
)
8181
}
8282

@@ -95,11 +95,11 @@ class CPUProfile extends Profile {
9595
*/
9696
bindingset[funcFullName, focusfuncFullName]
9797
QlBuiltins::BigInt cumTimeUnderFunc(string funcFullName, string focusfuncFullName) {
98-
result = sum(Sample sample
98+
result = sum(CPUSample sample
9999
| super.getSample(_) = sample and
100100
sample.containsFunc(funcFullName) and
101101
sample.containsFunc(focusfuncFullName)
102-
| sample.getValue(1)
102+
| sample.getTime()
103103
)
104104
}
105105

qlsrc/pprof_ext/malloc_time.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ string mallocgc() {
3232
* - mallocgcin16: mallocgc time within BenchmarkMalloc16 context (seconds)
3333
*/
3434
from CPUProfile profile
35-
select (sum(QlBuiltins::BigInt time, Sample sample | time = sample.getValue(1) and containsMallocgc(sample) | time)/1000000.toBigInt()).toInt() as mallocgc_time_ms,
35+
select (sum(QlBuiltins::BigInt time, CPUSample sample | time = sample.getTime() and containsMallocgc(sample) | time)/1000000.toBigInt()).toInt() as mallocgc_time_ms,
3636
profile.funcPercent(mallocgc(), 2) as mallocgc_percent,
3737
timeInUnit(profile.cumTimeOfFunc(mallocgc()), "s", 2) as cumTime,
3838
timeInUnit(profile.flatTimeOfFunc(mallocgc()), "s", 2) as flatTime,

0 commit comments

Comments
 (0)