1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | type EventName = string | (() => string);
|
11 | type EventArgs = {[key: string]: string} | void | null;
|
12 |
|
13 | /**
|
14 | * Indicates if the application is currently being traced.
|
15 | *
|
16 | * Calling methods on this module when the application isn't being traced is
|
17 | * cheap, but this method can be used to avoid computing expensive values for
|
18 | * those functions.
|
19 | *
|
20 | * @example
|
21 | * if (Systrace.isEnabled()) {
|
22 | * const expensiveArgs = computeExpensiveArgs();
|
23 | * Systrace.beginEvent('myEvent', expensiveArgs);
|
24 | * }
|
25 | */
|
26 | export function isEnabled(): boolean;
|
27 |
|
28 | /**
|
29 | * @deprecated This function is now a no-op but it's left for backwards
|
30 | * compatibility. `isEnabled` will now synchronously check if we're actively
|
31 | * profiling or not. This is necessary because we don't have callbacks to know
|
32 | * when profiling has started/stopped on Android APIs.
|
33 | */
|
34 | export function setEnabled(_doEnable: boolean): void;
|
35 |
|
36 | /**
|
37 | * Marks the start of a synchronous event that should end in the same stack
|
38 | * frame. The end of this event should be marked using the `endEvent` function.
|
39 | */
|
40 | export function beginEvent(eventName: EventName, args?: EventArgs): void;
|
41 |
|
42 | /**
|
43 | * Marks the end of a synchronous event started in the same stack frame.
|
44 | */
|
45 | export function endEvent(args?: EventArgs): void;
|
46 |
|
47 | /**
|
48 | * Marks the start of a potentially asynchronous event. The end of this event
|
49 | * should be marked calling the `endAsyncEvent` function with the cookie
|
50 | * returned by this function.
|
51 | */
|
52 | export function beginAsyncEvent(eventName: EventName, args?: EventArgs): number;
|
53 |
|
54 | /**
|
55 | * Registers a new value for a counter event.
|
56 | */
|
57 | export function endAsyncEvent(
|
58 | eventName: EventName,
|
59 | cookie: number,
|
60 | args?: EventArgs,
|
61 | ): void;
|
62 |
|
63 | /**
|
64 | * counterEvent registers the value to the eventName on the systrace timeline
|
65 | **/
|
66 | export function counterEvent(eventName: EventName, value: number): void;
|
67 |
|
\ | No newline at end of file |