New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

perftrace

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

perftrace

Record PerformanceEntry objects from Node.js and the Web in the Trace Event Format, so that it can be visualized on https://ui.perfetto.dev.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.5K
decreased by-47.26%
Maintainers
1
Weekly downloads
 
Created
Source

perftrace

Record PerformanceEntry objects from Node.js and the Web in the Trace Event Format, so that it can be visualized on https://ui.perfetto.dev.

Example in example.js

A new TraceEvents object is created in:

https://github.com/RaisinTen/perftrace/blob/18b4235b2b21d61a5aa167bf5e9c26cd5c6d90dc/example.js#L6

Before the process exits, the TraceEvents object is destroyed and the trace events are stringified and printed to events.json in:

https://github.com/RaisinTen/perftrace/blob/18b4235b2b21d61a5aa167bf5e9c26cd5c6d90dc/example.js#L8-L12

The code that needs to be profiled can be done using the peformance.measure() and peformance.mark() APIs from Node.js and the Web:

peformance.mark("before");
// code that needs to be profiled
performance.measure("after", "before");

like it's being done in:

https://github.com/RaisinTen/perftrace/blob/18b4235b2b21d61a5aa167bf5e9c26cd5c6d90dc/example.js#L14-L26

After running node example.js, the generated events.json file can be opened on https://ui.perfetto.dev for visualization:

Keywords

FAQs

Package last updated on 25 Apr 2024

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