1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { Readable as ReadableStream } from "stream";
|
9 | export interface Event {
|
10 | ts: number;
|
11 | pid: number;
|
12 | tid: number;
|
13 |
|
14 | ph?: string;
|
15 | [otherData: string]: any;
|
16 | }
|
17 | export interface Fields {
|
18 | cat?: any;
|
19 | args?: any;
|
20 | [filedName: string]: any;
|
21 | }
|
22 | export interface TracerOptions {
|
23 | parent?: Tracer | null;
|
24 | fields?: Fields | null;
|
25 | objectMode?: boolean | null;
|
26 | noStream?: boolean;
|
27 | }
|
28 | export declare class Tracer extends ReadableStream {
|
29 | private _objectMode;
|
30 |
|
31 | private _push;
|
32 | private firstPush?;
|
33 | private noStream;
|
34 | private events;
|
35 | private parent;
|
36 | private fields;
|
37 | constructor(opts?: TracerOptions);
|
38 | /**
|
39 | * If in no streamMode in order to flush out the trace
|
40 | * you need to call flush.
|
41 | */
|
42 | flush(): void;
|
43 | _read(_: number): void;
|
44 | private _pushString;
|
45 | private _flush;
|
46 | child(fields: Fields): Tracer;
|
47 | begin(fields: Fields): void;
|
48 | end(fields: Fields): void;
|
49 | completeEvent(fields: Fields): void;
|
50 | instantEvent(fields: Fields): void;
|
51 | mkEventFunc(ph: string): (fields: Fields) => void;
|
52 | }
|