0

I have the trace file from chrome dev tools for a specific workflow of my web app. I'm trying to figure out the total time taken by the workflow.

I'm doing this using a Puppeteer script and it's trace feature. I read through the trace file JSON, filter by phase type - 'X' which are Complete Events. After filtering I sum all the 'dur' fields, and I believe this should give me the total timing of the workflow.

The result is quite off though. The total duration is way too big to even consider remotely close to what I can visually see on the screen.

Assuming this time is in millseconds microseconds (didn't see it mentioned anywhere in JSON, except in the documenation linked at end of this post) .

Do I need to filter with any other fields as well? (possible duplicates?)

// filter out only complete events
const allCompleteEvents = parsedJSON.filter(e => e.ph === 'X')
                          .map(completeEvent => {
                              const {pid, tid, dur, name} = completeEvent;
                              return { pid, tid, dur, name}
                        });

// sum of durations...this number is way too big to be correct! 
const completeEventsDuration = completeEvents.reduce((total, curr) => total + curr.dur, 0);   

Reference: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#

rbk
  • 283
  • 2
  • 3
  • 16
  • @kayce-basques Do we have any documentation on how to consume the dev tools trace JSON? – rbk Sep 09 '19 at 12:39
  • 1
    Events may overlap so this won't work. AFAIK all you need is to find the biggest and lowest timestamps and subtract. – wOxxOm Sep 10 '19 at 05:59

0 Answers0