Skip to content

Commit d9e41fc

Browse files
committed
fix: replace instanceof back with extends to fix malloc_line problem
1 parent 5d81542 commit d9e41fc

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

qlsrc/pprof_ext/cpuprofile.qll

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ float timeInUnit(QlBuiltins::BigInt t, string unit, int precision) {
2121
/**
2222
* Extension of Profile providing aggregation methods for CPU sampling data.
2323
*/
24-
class CPUProfile instanceof Profile {
24+
class CPUProfile extends Profile {
2525
CPUProfile() {
26-
any()
26+
super.getPeriodType().getType() = "cpu" and
27+
super.getPeriodType().getUnit() = "nanoseconds" and
28+
super.getSampleType(0).getType() = "samples" and
29+
super.getSampleType(0).getUnit() = "count" and
30+
super.getSampleType(1).getType() = "cpu" and
31+
super.getSampleType(1).getUnit() = "nanoseconds"
2732
}
2833

29-
string toString() { result = "CPUProfile " + this.(int).toString() }
30-
3134
/**
3235
* Sum of all sample values at index 1 (total time in nanoseconds).
3336
*/
@@ -99,5 +102,11 @@ class CPUProfile instanceof Profile {
99102
| sample.getValue(1)
100103
)
101104
}
105+
106+
string flameGraphRootFuncName() {
107+
exists(Sample sample
108+
| sample.getLocation(sample.locationNum()-1).getLastLine().getFunction().getName() = result
109+
)
110+
}
102111
}
103112

qlsrc/pprof_ext/heapprofile.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import profile
1616
* Each sample also carries a numeric label "bytes" indicating
1717
* the average block size (AllocBytes / AllocObjects) for that sample.
1818
*/
19-
class HeapProfile instanceof Profile {
19+
class HeapProfile extends Profile {
2020
HeapProfile() {
2121
// Period type must be ("space", "bytes")
2222
super.getPeriodType().getType() = "space" and
@@ -33,9 +33,6 @@ class HeapProfile instanceof Profile {
3333
super.getSampleType(3).getUnit() = "bytes"
3434
}
3535

36-
string toString() {
37-
result = "HeapProfile " + this.(int).toString()
38-
}
3936

4037
// -----------------------------------------------------------------------
4138
// Sum helpers — total across all samples for each value index

0 commit comments

Comments
 (0)