aslushnikov / tracium

A blessed Chrome Trace parser.
Apache License 2.0
72 stars 7 forks source link

Tracium

Tracium is the Google Lighthouse tracing parser extracted into a stand-alone library.

Tracium is a modern alternative to Big Rig. Tracium correctly parses modern Chrome Traces (generated by Chrome 66+).

Usage

Install:

$ npm install tracium

Use:

const Tracium = require('tracium');
const traceJSON = JSON.parse(fs.readFileSync('./mytrace.json', 'utf8'));
const tasks = Tracium.computeMainThreadTasks(traceJSON, {
  // |flatten| default to |false|. When false, only top-level tasks will be returned.
  flatten: true,
});

Check out examples at //examples/ folder.

API

tracium.computeMainThreadTasks(traceJson[, options])

Returns an array of tasks that belong to the main thread of the inspected page. If flatten is passed to false, than only top-level tasks will be returned.

An example task ``` { event: { pid: 29772, tid: 775, ts: 588826692280, ph: 'X', cat: 'toplevel', name: 'TaskQueueManager::ProcessTaskFromWorkQueue', args: { src_file: '../../base/trace_event/trace_log.cc', src_func: 'SetEnabled' }, dur: 27, tdur: 22, tts: 514358 }, startTime: 0, endTime: 0.027, children: [], duration: 0.027, selfTime: 0.027, kind: 'other' } ```