UNPKG

1.68 kBTypeScriptView Raw
1export interface ProfilerEvent {
2 /** The name of the event, as displayed in Trace Viewer */
3 name: string;
4 /** The event categories. This is a comma separated list of categories for the event. The categories can be used to hide events in the Trace Viewer UI. */
5 cat: string;
6 /** The event type. This is a single character which changes depending on the type of event being output. The valid values are listed in the table below. We will discuss each phase type below. */
7 ph: string;
8 /** The tracing clock timestamp of the event. The timestamps are provided at microsecond granularity. */
9 ts: number;
10 /** Optional. The thread clock timestamp of the event. The timestamps are provided at microsecond granularity. */
11 tts?: string;
12 /** The process ID for the process that output this event. */
13 pid: number;
14 /** The thread ID for the thread that output this event. */
15 tid: number;
16 /** Any arguments provided for the event. Some of the event types have required argument fields, otherwise, you can put any information you wish in here. The arguments are displayed in Trace Viewer when you view an event in the analysis section. */
17 args?: any;
18 /** duration */
19 dur: number;
20 /** A fixed color name to associate with the event. If provided, cname must be one of the names listed in trace-viewer's base color scheme's reserved color names list */
21 cname?: string;
22}
23export interface Profiler {
24 run<T>(fn: () => Promise<T>, name: string, cat?: string): Promise<T>;
25 collect(): ProfilerEvent[];
26}
27export declare function createNoopProfiler(): Profiler;
28export declare function createProfiler(): Profiler;
29
\No newline at end of file