Stackprof: stack garbage collection frames on top of previous stack (#85)
We do a similar thing for Chrome to make the flamegraphs more readable
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+8
-1
@@ -21,10 +21,13 @@ export function importFromStackprof(stackprofProfile: StackprofProfile): Profile
|
||||
|
||||
const {frames, raw, raw_timestamp_deltas} = stackprofProfile
|
||||
let sampleIndex = 0
|
||||
|
||||
let prevStack: FrameInfo[] = []
|
||||
|
||||
for (let i = 0; i < raw.length; ) {
|
||||
const stackHeight = raw[i++]
|
||||
|
||||
const stack: FrameInfo[] = []
|
||||
let stack: FrameInfo[] = []
|
||||
for (let j = 0; j < stackHeight; j++) {
|
||||
const id = raw[i++]
|
||||
stack.push({
|
||||
@@ -32,6 +35,9 @@ export function importFromStackprof(stackprofProfile: StackprofProfile): Profile
|
||||
...frames[id],
|
||||
})
|
||||
}
|
||||
if (stack.length === 1 && stack[0].name === '(garbage collection)') {
|
||||
stack = prevStack.concat(stack)
|
||||
}
|
||||
const nSamples = raw[i++]
|
||||
|
||||
let sampleDuration = 0
|
||||
@@ -40,6 +46,7 @@ export function importFromStackprof(stackprofProfile: StackprofProfile): Profile
|
||||
}
|
||||
|
||||
profile.appendSample(stack, sampleDuration)
|
||||
prevStack = stack
|
||||
}
|
||||
|
||||
profile.setValueFormatter(new TimeFormatter('microseconds'))
|
||||
|
||||
Reference in New Issue
Block a user