Repository navigation
Expand file tree
/
Copy pathprofiling.ts
More file actions
157 lines (143 loc) · 3.21 KB
/
Copy pathprofiling.ts
File metadata and controls
157 lines (143 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import type { Client } from '../client';
import type { DebugImage } from './debugMeta';
import type { Integration } from './integration';
import type { MeasurementUnit } from './measurement';
export interface ContinuousProfiler<T extends Client> {
initialize(client: T): void;
start(): void;
stop(): void;
}
export interface ProfilingIntegration<T extends Client = Client> extends Integration {
_profiler: ContinuousProfiler<T>;
}
export interface Profiler {
/**
* Starts the profiler.
*/
startProfiler(): void;
/**
* Stops the profiler.
*/
stopProfiler(): void;
}
export type ThreadId = string;
export type FrameId = number;
export type StackId = number;
export interface ThreadCpuSample {
stack_id: StackId;
thread_id: ThreadId;
queue_address?: string;
elapsed_since_start_ns: string;
}
export interface ContinuousThreadCpuSample {
stack_id: StackId;
thread_id: ThreadId;
queue_address?: string;
timestamp: number;
}
export type ThreadCpuStack = FrameId[];
export type ThreadCpuFrame = {
function?: string;
file?: string;
lineno?: number;
colno?: number;
abs_path?: string;
platform?: string;
instruction_addr?: string;
module?: string;
in_app?: boolean;
};
export interface ThreadCpuProfile {
samples: ThreadCpuSample[];
stacks: ThreadCpuStack[];
frames: ThreadCpuFrame[];
thread_metadata: Record<ThreadId, { name?: string; priority?: number }>;
queue_metadata?: Record<string, { label: string }>;
}
export interface ContinuousThreadCpuProfile {
samples: ContinuousThreadCpuSample[];
stacks: ThreadCpuStack[];
frames: ThreadCpuFrame[];
thread_metadata: Record<ThreadId, { name?: string; priority?: number }>;
queue_metadata?: Record<string, { label: string }>;
}
interface BaseProfile<T> {
version: string;
release: string;
environment: string;
platform: string;
profile: T;
debug_meta?: {
images: DebugImage[];
};
measurements?: Record<
string,
{
unit: MeasurementUnit;
values: {
elapsed_since_start_ns: number;
value: number;
}[];
}
>;
}
export interface Profile extends BaseProfile<ThreadCpuProfile> {
event_id: string;
version: string;
os: {
name: string;
version: string;
build_number?: string;
};
runtime: {
name: string;
version: string;
};
device: {
architecture: string;
is_emulator: boolean;
locale: string;
manufacturer: string;
model: string;
};
timestamp: string;
release: string;
environment: string;
platform: string;
profile: ThreadCpuProfile;
debug_meta?: {
images: DebugImage[];
};
transaction?: {
name: string;
id: string;
trace_id: string;
active_thread_id: string;
};
transactions?: {
name: string;
id: string;
trace_id: string;
active_thread_id: string;
relative_start_ns: string;
relative_end_ns: string;
}[];
measurements?: Record<
string,
{
unit: MeasurementUnit;
values: {
elapsed_since_start_ns: number;
value: number;
}[];
}
>;
}
export interface ProfileChunk extends BaseProfile<ContinuousThreadCpuProfile> {
chunk_id: string;
profiler_id: string;
client_sdk: {
name: string;
version: string;
};
}