Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbers not matching summary #37

Open
dbajric opened this issue Jul 16, 2018 · 2 comments
Open

Numbers not matching summary #37

dbajric opened this issue Jul 16, 2018 · 2 comments

Comments

@dbajric
Copy link

dbajric commented Jul 16, 2018

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

@ogawahideki
Copy link

ogawahideki commented Aug 1, 2018

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

@raviregina
Copy link

@paulirish is there any update on this request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants