Skip to content

Perfetto in Node.js #277

Closed
Closed
@kjin

Description

@kjin

Perfetto (source) is an open-source tracing system that has been adopted in Android and Chromium. We are proposing to introduce it into Node as well; in short, it would replace some of Node's current implementation for writing trace events.

What it is

The website has more detail, but for our purposes Perfetto is a (C++) library that defines interactions between producers and consumers of trace events (and other instrumentation data). Producers and consumers don't communicate directly but through a central "tracing service". Trace events are flushed from producers to the tracing service via a shared memory buffer.

Perfetto supports, and provides an implementation for, communication between producers/consumers and the tracing service over IPC, via protobufs. I believe this is largely meant for OS-wide trace collection. For Node, we would most likely not use IPC, and just have everything be in-process, which Perfetto also supports.

The trace events implementation in Chromium is currently using Perfetto.

How Node benefits from it

Perfetto would replace the current mechanism for buffering and writing trace events. It would be arguably more stable than the current trace event writer implementation in Node, and also provide a standardized set of config options (such as buffer size, file options) for trace events. It would also be easier to reason about having multiple consumers for trace events (writing to file thru command line options; inspector; JS API) as this is intrinsic to Perfetto's design.

The current system for creating trace events would not change; the trace event macros as they are now would remain the same.

Current plans

I'm currently working on a demo, and can talk and answer questions at the Diagnostics meeting tomorrow and in future sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions