mirror of
https://github.com/jlfwong/speedscope.git
synced 2024-11-29 09:35:44 +03:00
Fix for Chrome timelines containing multiple CPU profiles
This commit is contained in:
parent
f9af0fddb2
commit
f25f8fc5cc
@ -45,12 +45,17 @@ interface CPUProfile {
|
||||
}
|
||||
|
||||
export function importFromChromeTimeline(events: TimelineEvent[]) {
|
||||
const profileEvent = events[events.length - 1]
|
||||
const chromeProfile = profileEvent.args.data.cpuProfile as CPUProfile
|
||||
return importFromChromeCPUProfile(chromeProfile)
|
||||
// It seems like sometimes Chrome timeline files contain multiple CpuProfiles?
|
||||
// For now, choose the first one in the list.
|
||||
for (let event of events) {
|
||||
if (event.name == "CpuProfile") {
|
||||
const chromeProfile = event.args.data.cpuProfile as CPUProfile
|
||||
return importFromChromeCPUProfile(chromeProfile)
|
||||
}
|
||||
}
|
||||
throw new Error("Could not find CPU profile in Timeline")
|
||||
}
|
||||
|
||||
|
||||
const callFrameToFrameInfo = new Map<CPUProfileCallFrame, FrameInfo>()
|
||||
function frameInfoForCallFrame(callFrame: CPUProfileCallFrame) {
|
||||
return getOrInsert(callFrameToFrameInfo, callFrame, (callFrame) => {
|
||||
|
Loading…
Reference in New Issue
Block a user