paulirish / devtools-timeline-model

Unsupported

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numbers not matching summary

dbajric opened this issue · 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

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

@paulirish is there any update on this request?