Utilities

Convert a Perfetto trace to JSON

Convert a supplied local trace into native Chrome trace-event JSON with Perfetto traceconv.

Agent

overview

What perfetto-trace-json does

Convert a supplied local trace into native Chrome trace-event JSON with Perfetto traceconv.

The adapter first asks the pinned native processor for import error statistics and rejects a trace with reported errors before publishing output. The output retains native traceEvents and metadata. Timing statistics in metadata can vary between runs. Conversion does not record a trace, symbolize an APK, connect to a device, or prove that a trace contains every event you expected.

The input must be a nonempty regular file of at most 20 MiB. Native import-stat validation and the query or conversion share a 90-second deadline. Each artifact/log has a 4 MiB check after its native process exits; these checks do not contain peak memory or disk use.

source hub.docker.com/r/nenadzaric/skills-android-perfetto-trace-json

use cases

Where perfetto-trace-json fits

Feed a trace-event JSON consumer

Export a separately collected trace to a JSON FILE for downstream tools that consume Chrome trace events.

Keep file processing separate from recording

Supply an existing trace FILE. This node exposes no recording, daemon, device, remote URL, credentials or caller-written SQL.

Distinguish a valid empty trace from a parse failure

The adapter checks native import error statistics before producing output. Native fixtures cover valid-empty and malformed traces; the owned positive trace also passed a three-node platform workflow.

reference

perfetto-trace-json inputs and flags

1 inputs
NameTypeFlagDescription
traceFILE--traceExisting local trace FILE, nonempty and at most 20 MiB.

Showing key inputs. perfetto-trace-json exposes 1 inputs in total.

example

Run perfetto-trace-json

perfetto-trace-json · command
perfetto-trace-json --trace owned.pftrace -o trace.json
sample output
{"traceEvents":[
{"args":{"name":"swapper"},"cat":"__metadata","name":"thread_name","ph":"M","pid":0,"tid":0,"ts":0},
{"args":{"name":"owned"},"cat":"__metadata","name":"thread_name","ph":"M","pid":42,"tid":42,"ts":0},
{"args":{},"cat":"owned","dur":2000,"name":"CounterWork","ph":"X","pid":42,"tid":42,"ts":1000}],"metadata":

guidance

Choosing perfetto-trace-json

Choose this conversion job when your downstream consumer needs individual native trace events. Choose perfetto-slice-summary for grouped completed-slice counts and duration sums.

perfetto-slice-summary

Sibling offline trace job. Event JSON preserves events for inspection; grouped CSV summarizes completed slices by name.

faq

perfetto-trace-json questions

No. Supply a trace you collected separately. The node exposes no recording, device connection or daemon.

No. The registered input is one local trace FILE. The adapter uses fixed native commands and fixed SQL.

The output retains native traceEvents and metadata. Timing statistics in metadata can vary between runs. Conversion does not record a trace, symbolize an APK, connect to a device, or prove that a trace contains every event you expected.

The input must be a nonempty regular file of at most 20 MiB. Native import-stat validation and the query or conversion share a 90-second deadline. Each artifact/log has a 4 MiB check after its native process exits; these checks do not contain peak memory or disk use.

The locally built fixture1 image passed six native cases: positive, valid empty trace, malformed trace, missing input, oversized input and refusal to overwrite a nonempty output. The same runtime also passed an owned-trace platform workflow with downloaded output and verifier checks. Public source and component notices are available through the source link.

The source link provides immutable ORAS retrieval directions and the bundle SHA-256 for the actual custom adapter, Dockerfile, fixtures, pinned Perfetto source and component notices. The native source is Perfetto v58.2 commit add693d8b338ba9599dbcbc3e300b1ab8c000897; its core license is Apache-2.0 and dependency terms are retained.

Run perfetto-trace-json yourself

Opening excerpt of native Chrome trace-event JSON from the owned trace, also verified in a platform run. CounterWork lasts 2,000 microseconds; additional native metadata is omitted here and timing metadata can vary between runs.

Facts on this page come from the live Trickest tool library.