devtools-timeline-model icon indicating copy to clipboard operation
devtools-timeline-model copied to clipboard

Numbers not matching summary

Open dbajric opened this issue 7 years ago • 2 comments

Hello -

I am trying to automate some performance measurements and I want to get the results from the Summary chart in DevTools. Specifically, I am looking at the Scripting category.

I am running into an issue where the numbers between the devtools-timeline-model library and DevTools are different. In the attached profile file, I get 847.2ms in DevTools/Chrome while I get 833.98ms using the devtools-timeline-model library.

Here is the code snippet that I am using to get the total time spent in Scripting:

(async () => { const puppeteer = require("puppeteer"); const devtools = require("devtools-timeline-model"); const fs = require("fs"); const format = require("date-format"); const browser = await puppeteer.launch({ headless: false }); const page = await browser.newPage(); const client = await page.target().createCDPSession(); const traceFile = "trace-" + format('yyyyMMddhhmmss', new Date()) + ".json"; await client.send("Performance.enable"); await page.tracing.start({ path: traceFile }); await page.goto('https://www.msn.com'); await page.tracing.stop(); var events = fs.readFileSync(traceFile, "utf8"); var model = new devtools(events); var summary = model.topDownGroupBy("Category").children; if(summary.has("scripting")) { console.log(summary.get("scripting").totalTime); } await browser.close(); })();

Why would I get different numbers between what the code prints to console vs. when I open the same capture file in DevTools?

trace-20180716135307.json.zip

dbajric avatar Jul 16 '18 21:07 dbajric

@paulirish @dbajric I have the same problem. Do you have any progress?

ogawahideki avatar Aug 01 '18 09:08 ogawahideki

@paulirish is there any update on this request?

raviregina avatar Jan 27 '20 12:01 raviregina