Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tracerbench/trace-model

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tracerbench/trace-model

Minimal model of Chrome TraceEvents

  • 4.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

@tracerbench/trace-model

Builds a minimal model of the trace.

  • Stable sorts events on ts.
  • Assigns processes and threads metadata, bounds and events.
  • Normalizes begin/end events into complete events and assigns parent refs from containment.
  • Events are monomorphic and have access to the original trace event but all the basic props are lifted.
  • Events have convenience methods for checking common phase types and accessing args.
  • Category is split into a set if it is comma delimited and the disabled-by-default- prefix has been removed.

Example

import { buildModel } from '@tracerbench/trace-model';
import { readFileSync } from 'fs';
const trace = JSON.parse(readFileSync('trace.json', 'utf8'));
const model = buildModel(trace);
console.log(trace.start, trace.end, trace.duration);
for (const process of model.processes) {
  console.log(process.name);
  console.log(process.labels);
  console.log(process.start, process.end, process.duration);
  for (const thread of process.threads) {
    console.log(thread.name);
    console.log(thread.start, thread.end, thread.duration);
  }
}
const rendererMain = model.findRendererMain();
const slices = rendererMain.events.filter((event) => event.isComplete());
for (const toplevel of slices.filter((event) => event.parent === undefined)) {
  console.log('%o', toplevel);
}

Keywords

FAQs

Package last updated on 17 Sep 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc