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+).
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.
traceJson
<Object> A JSON of a Chromium traceoptions
<Object> Set of options for trace processing
flatten
<boolean> Defaults to false
. Whether to flatten tasks tree. kind
<string> describes task attribution. Can be one of the following:'parseHTML'
'styleLayout'
'paintCompositeRender'
'scriptParseCompile'
'scriptEvaluation'
'garbageCollection'
'other'
startTime
<number> monotonic start time in millisecondsendTime
<number> monotonic end time in millisecondsduration
<number> task duration in milliseconds, a.k.a. "wall time"selfTime
<number> time spent in the task at the current level of the task treeevent
<Object> original trace event object associated with the taskchildren
<Array<[Task]>> an array of child tasksparent
<?[Task]> a parent task if anyReturns 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.