|
| 1 | +import {EventsPhase} from './Phases'; |
| 2 | + |
| 3 | +export interface SharedEventProperties { |
| 4 | + /** |
| 5 | + * name of the event |
| 6 | + */ |
| 7 | + name?: string; |
| 8 | + /** |
| 9 | + * event category |
| 10 | + */ |
| 11 | + cat?: string; |
| 12 | + /** |
| 13 | + * tracing clock timestamp |
| 14 | + */ |
| 15 | + ts?: number; |
| 16 | + /** |
| 17 | + * process ID |
| 18 | + */ |
| 19 | + pid?: number; |
| 20 | + /** |
| 21 | + * thread ID |
| 22 | + */ |
| 23 | + tid?: number; |
| 24 | + /** |
| 25 | + * event type (phase) |
| 26 | + */ |
| 27 | + ph: EventsPhase; |
| 28 | + /** |
| 29 | + * id for a stackFrame object |
| 30 | + */ |
| 31 | + sf?: number; |
| 32 | + /** |
| 33 | + * thread clock timestamp |
| 34 | + */ |
| 35 | + tts?: number; |
| 36 | + /** |
| 37 | + * a fixed color name |
| 38 | + */ |
| 39 | + cname?: string; |
| 40 | + /** |
| 41 | + * event arguments |
| 42 | + */ |
| 43 | + args?: {[key in string]: any}; |
| 44 | +} |
| 45 | + |
| 46 | +interface DurationEventBegin extends SharedEventProperties { |
| 47 | + ph: EventsPhase.DURATION_EVENTS_BEGIN; |
| 48 | +} |
| 49 | + |
| 50 | +interface DurationEventEnd extends SharedEventProperties { |
| 51 | + ph: EventsPhase.DURATION_EVENTS_END; |
| 52 | +} |
| 53 | + |
| 54 | +export type DurationEvent = DurationEventBegin | DurationEventEnd; |
| 55 | + |
| 56 | +export type Event = DurationEvent; |
| 57 | + |
| 58 | +/** |
| 59 | + * Each item in the stackFrames object of the hermes profile |
| 60 | + */ |
| 61 | +export interface HermesStackFrame { |
| 62 | + line: string; |
| 63 | + column: string; |
| 64 | + funcLine: string; |
| 65 | + funcColumn: string; |
| 66 | + name: string; |
| 67 | + category: string; |
| 68 | + /** |
| 69 | + * A parent function may or may not exist |
| 70 | + */ |
| 71 | + parent?: number; |
| 72 | +} |
| 73 | +/** |
| 74 | + * Each item in the samples array of the hermes profile |
| 75 | + */ |
| 76 | +export interface HermesSample { |
| 77 | + cpu: string; |
| 78 | + name: string; |
| 79 | + ts: string; |
| 80 | + pid: number; |
| 81 | + tid: string; |
| 82 | + weight: string; |
| 83 | + /** |
| 84 | + * Will refer to an element in the stackFrames object of the Hermes Profile |
| 85 | + */ |
| 86 | + sf: number; |
| 87 | + stackFrameData?: HermesStackFrame; |
| 88 | +} |
| 89 | + |
| 90 | +/** |
| 91 | + * Hermes Profile Interface |
| 92 | + */ |
| 93 | +export interface HermesCPUProfile { |
| 94 | + traceEvents: SharedEventProperties[]; |
| 95 | + samples: HermesSample[]; |
| 96 | + stackFrames: {[key in string]: HermesStackFrame}; |
| 97 | +} |
| 98 | + |
| 99 | +export interface CPUProfileChunk { |
| 100 | + id: string; |
| 101 | + pid: number; |
| 102 | + tid: string; |
| 103 | + startTime: number; |
| 104 | + nodes: CPUProfileChunkNode[]; |
| 105 | + samples: number[]; |
| 106 | + timeDeltas: number[]; |
| 107 | +} |
| 108 | + |
| 109 | +export interface CPUProfileChunkNode { |
| 110 | + id: number; |
| 111 | + callFrame: { |
| 112 | + line: string; |
| 113 | + column: string; |
| 114 | + funcLine: string; |
| 115 | + funcColumn: string; |
| 116 | + name: string; |
| 117 | + url?: string; |
| 118 | + category: string; |
| 119 | + }; |
| 120 | + parent?: number; |
| 121 | +} |
| 122 | + |
| 123 | +export type CPUProfileChunker = { |
| 124 | + nodes: CPUProfileChunkNode[]; |
| 125 | + sampleNumbers: number[]; |
| 126 | + timeDeltas: number[]; |
| 127 | +}; |
| 128 | + |
| 129 | +export interface SourceMap { |
| 130 | + version: string; |
| 131 | + sources: string[]; |
| 132 | + sourceContent: string[]; |
| 133 | + x_facebook_sources: {names: string[]; mappings: string}[] | null; |
| 134 | + names: string[]; |
| 135 | + mappings: string; |
| 136 | +} |
0 commit comments