Socket
Book a DemoInstallSign in
Socket

@sitespeed.io/tracium

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sitespeed.io/tracium

Chromium trace parser not throwing errors

0.3.3
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

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])

  • traceJson <Object> A JSON of a Chromium trace
  • options <Object> Set of options for trace processing
    • flatten <boolean> Defaults to false. Whether to flatten tasks tree.
  • returns: <Array<Object>> An array of tasks:
    • kind <string> describes task attribution. Can be one of the following:
      • 'parseHTML'
      • 'styleLayout'
      • 'paintCompositeRender'
      • 'scriptParseCompile'
      • 'scriptEvaluation'
      • 'garbageCollection'
      • 'other'
    • startTime <number> monotonic start time in milliseconds
    • endTime <number> monotonic end time in milliseconds
    • duration <number> task duration in milliseconds, a.k.a. "wall time"
    • selfTime <number> time spent in the task at the current level of the task tree
    • event <Object> original trace event object associated with the task
    • children <Array<[Task]>> an array of child tasks
    • parent <?[Task]> a parent task if any

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' }

FAQs

Package last updated on 30 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.