mirror of
https://github.com/jlfwong/speedscope.git
synced 2024-11-25 20:51:51 +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[]) {
|
export function importFromChromeTimeline(events: TimelineEvent[]) {
|
||||||
const profileEvent = events[events.length - 1]
|
// It seems like sometimes Chrome timeline files contain multiple CpuProfiles?
|
||||||
const chromeProfile = profileEvent.args.data.cpuProfile as CPUProfile
|
// For now, choose the first one in the list.
|
||||||
return importFromChromeCPUProfile(chromeProfile)
|
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>()
|
const callFrameToFrameInfo = new Map<CPUProfileCallFrame, FrameInfo>()
|
||||||
function frameInfoForCallFrame(callFrame: CPUProfileCallFrame) {
|
function frameInfoForCallFrame(callFrame: CPUProfileCallFrame) {
|
||||||
return getOrInsert(callFrameToFrameInfo, callFrame, (callFrame) => {
|
return getOrInsert(callFrameToFrameInfo, callFrame, (callFrame) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user