getPerfetto

Returns the runtime's Perfetto tracing API, for adding your own events to a performance trace

import { getPerfetto } from "@roku-sdk/runtime/perfetto";
getPerfetto(): Perfetto

Description

Returns the runtime's Perfetto tracing API, for adding your own events to a performance trace.

Use it to mark the start and end of work, or a single instant, so that it appears in the Perfetto trace viewer. On devices whose runtime has no Perfetto support, it returns an object whose methods do nothing, so tracing calls can stay in the app.

Return values

The runtime's Perfetto object, or a no-op stand-in when tracing is unavailable.

Example

const perfetto = getPerfetto();
perfetto.beginEvent("load-catalog");
await loadCatalog();
perfetto.endEvent();

What’s Next

Did this page help you?