@parca/profile 0.16.0 → 0.16.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/Callgraph/Edge/index.d.ts +22 -0
- package/dist/Callgraph/Edge/index.js +30 -0
- package/dist/Callgraph/Node/index.d.ts +19 -0
- package/dist/Callgraph/Node/index.js +37 -0
- package/dist/Callgraph/index.d.ts +8 -0
- package/dist/Callgraph/index.js +137 -0
- package/dist/Callgraph/mockData/index.d.ts +148 -0
- package/dist/Callgraph/mockData/index.js +577 -0
- package/dist/Callgraph/utils.d.ts +19 -0
- package/dist/Callgraph/utils.js +82 -0
- package/dist/GraphTooltip/index.d.ts +19 -0
- package/dist/GraphTooltip/index.js +119 -0
- package/dist/IcicleGraph.d.ts +35 -0
- package/dist/IcicleGraph.js +139 -0
- package/dist/MatchersInput/index.d.ts +23 -0
- package/dist/MatchersInput/index.js +479 -0
- package/dist/MetricsCircle/index.d.ts +7 -0
- package/dist/MetricsCircle/index.js +18 -0
- package/dist/MetricsGraph/index.d.ts +35 -0
- package/dist/MetricsGraph/index.js +349 -0
- package/dist/MetricsSeries/index.d.ts +11 -0
- package/dist/MetricsSeries/index.js +21 -0
- package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts +19 -0
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +38 -0
- package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts +15 -0
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +19 -0
- package/dist/ProfileExplorer/index.d.ts +9 -0
- package/dist/ProfileExplorer/index.js +203 -0
- package/dist/ProfileIcicleGraph.d.ts +10 -0
- package/dist/ProfileIcicleGraph.js +28 -0
- package/dist/ProfileMetricsGraph/index.d.ts +22 -0
- package/dist/ProfileMetricsGraph/index.js +127 -0
- package/dist/ProfileSVG.module.css +3 -0
- package/dist/ProfileSelector/CompareButton.d.ts +5 -0
- package/dist/ProfileSelector/CompareButton.js +41 -0
- package/dist/ProfileSelector/MergeButton.d.ts +5 -0
- package/dist/ProfileSelector/MergeButton.js +41 -0
- package/dist/ProfileSelector/index.d.ts +29 -0
- package/dist/ProfileSelector/index.js +133 -0
- package/dist/ProfileSource.d.ts +88 -0
- package/dist/ProfileSource.js +239 -0
- package/dist/ProfileTypeSelector/index.d.ts +20 -0
- package/dist/ProfileTypeSelector/index.js +138 -0
- package/dist/ProfileView.d.ts +39 -0
- package/dist/ProfileView.js +111 -0
- package/dist/ProfileView.styles.css +3 -0
- package/dist/ProfileViewWithData.d.ts +11 -0
- package/dist/ProfileViewWithData.js +116 -0
- package/dist/TopTable.d.ts +9 -0
- package/dist/TopTable.js +140 -0
- package/dist/TopTable.styles.css +7 -0
- package/dist/components/DiffLegend.d.ts +2 -0
- package/dist/components/DiffLegend.js +62 -0
- package/dist/components/ProfileShareButton/ResultBox.d.ts +6 -0
- package/dist/components/ProfileShareButton/ResultBox.js +46 -0
- package/dist/components/ProfileShareButton/index.d.ts +7 -0
- package/dist/components/ProfileShareButton/index.js +119 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +64 -0
- package/dist/styles.css +1 -0
- package/dist/useDelayedLoader.d.ts +5 -0
- package/dist/useDelayedLoader.js +33 -0
- package/dist/useQuery.d.ts +13 -0
- package/dist/useQuery.js +41 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +83 -0
- package/package.json +12 -8
- package/src/Callgraph/Edge/index.tsx +59 -0
- package/src/Callgraph/Node/index.tsx +66 -0
- package/src/Callgraph/index.tsx +169 -0
- package/src/Callgraph/mockData/index.ts +605 -0
- package/src/Callgraph/utils.ts +116 -0
- package/src/GraphTooltip/index.tsx +245 -0
- package/src/IcicleGraph.tsx +3 -3
- package/src/MatchersInput/index.tsx +698 -0
- package/src/MetricsCircle/index.tsx +28 -0
- package/src/MetricsGraph/index.tsx +614 -0
- package/src/MetricsSeries/index.tsx +38 -0
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +109 -0
- package/src/ProfileExplorer/ProfileExplorerSingle.tsx +72 -0
- package/src/ProfileExplorer/index.tsx +377 -0
- package/src/ProfileMetricsGraph/index.tsx +143 -0
- package/src/ProfileSelector/CompareButton.tsx +72 -0
- package/src/ProfileSelector/MergeButton.tsx +72 -0
- package/src/ProfileSelector/index.tsx +270 -0
- package/src/ProfileTypeSelector/index.tsx +180 -0
- package/src/ProfileView.tsx +2 -7
- package/src/index.tsx +11 -0
- package/src/useQuery.tsx +1 -0
- package/tailwind.config.js +8 -0
- package/tsconfig.json +7 -3
- package/typings.d.ts +14 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
// Copyright 2022 The Parca Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export var dotGraph = "{\n n1 [Label = \"n1\"];\n n2 [Label = \"n2\"];\n n3 [Label = \"n3\"];\n n1 -- n2;\n n1 -- n3;\n n2 -- n2;\n}";
|
|
14
|
+
export var jsonGraph = {
|
|
15
|
+
total: '4358676',
|
|
16
|
+
unit: 'count',
|
|
17
|
+
nodes: [
|
|
18
|
+
{
|
|
19
|
+
id: 'n0',
|
|
20
|
+
label: 'A node',
|
|
21
|
+
value: 30,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'n1',
|
|
25
|
+
label: 'Another node',
|
|
26
|
+
value: 20,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'n2',
|
|
30
|
+
label: 'And a last one',
|
|
31
|
+
value: 10,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'n3',
|
|
35
|
+
label: 'n3',
|
|
36
|
+
value: 2,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'n4',
|
|
40
|
+
label: 'n4',
|
|
41
|
+
value: 1,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'n5',
|
|
45
|
+
label: 'n5',
|
|
46
|
+
value: 1,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
edges: [
|
|
50
|
+
{
|
|
51
|
+
id: 'e0',
|
|
52
|
+
source: 'n0',
|
|
53
|
+
target: 'n1',
|
|
54
|
+
label: 'edge 1',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'e1',
|
|
58
|
+
source: 'n1',
|
|
59
|
+
target: 'n2',
|
|
60
|
+
label: 'edge 2',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'e2',
|
|
64
|
+
source: 'n2',
|
|
65
|
+
target: 'n0',
|
|
66
|
+
label: 'edge 3',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'e3',
|
|
70
|
+
source: 'n0',
|
|
71
|
+
target: 'n2',
|
|
72
|
+
label: 'edge 4',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'e4',
|
|
76
|
+
source: 'n2',
|
|
77
|
+
target: 'n3',
|
|
78
|
+
label: 'edge 5',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'e5',
|
|
82
|
+
source: 'n3',
|
|
83
|
+
target: 'n4',
|
|
84
|
+
label: 'edge 6',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'e5',
|
|
88
|
+
source: 'n4',
|
|
89
|
+
target: 'n5',
|
|
90
|
+
label: 'edge 6',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'e5',
|
|
94
|
+
source: 'n3',
|
|
95
|
+
target: 'n5',
|
|
96
|
+
label: 'edge 6',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
// just a string, doesn't need to be on separate lines
|
|
101
|
+
export var graphvizDot = "\ndigraph {\n N1 [id=\"node1\"]\n N2 [id=\"node2\"]\n N3 [id=\"node3\"]\n N4 [id=\"node4\"]\n N1 -> N2 [id=\"e1\" label=\"e1 fdskjao fdjksaol\"]\n N2 -> N3 [id=\"e2\" label=\"e2\"]\n N3 -> N4 [id=\"e3\" label=\"e3\"]\n N3 -> N1 [id=\"e4\" label=\"e4\"]\n }";
|
|
102
|
+
export var jsonGraphWithGraphvizPositions = {
|
|
103
|
+
name: '%27',
|
|
104
|
+
directed: true,
|
|
105
|
+
strict: false,
|
|
106
|
+
_draw_: [
|
|
107
|
+
{
|
|
108
|
+
op: 'c',
|
|
109
|
+
grad: 'none',
|
|
110
|
+
color: '#fffffe00',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
op: 'C',
|
|
114
|
+
grad: 'none',
|
|
115
|
+
color: '#ffffff',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
op: 'P',
|
|
119
|
+
points: [
|
|
120
|
+
[0.0, 0.0],
|
|
121
|
+
[0.0, 180.0],
|
|
122
|
+
[59.0, 180.0],
|
|
123
|
+
[59.0, 0.0],
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
bb: '0,0,59,180',
|
|
128
|
+
xdotversion: '1.7',
|
|
129
|
+
_subgraph_cnt: 0,
|
|
130
|
+
objects: [
|
|
131
|
+
{
|
|
132
|
+
_gvid: 0,
|
|
133
|
+
name: 'n0',
|
|
134
|
+
Label: 'A node',
|
|
135
|
+
_draw_: [
|
|
136
|
+
{
|
|
137
|
+
op: 'c',
|
|
138
|
+
grad: 'none',
|
|
139
|
+
color: '#000000',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
op: 'C',
|
|
143
|
+
grad: 'none',
|
|
144
|
+
color: '#ffffff',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
op: 'E',
|
|
148
|
+
rect: [41.0, 162.0, 18.0, 18.0],
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
_ldraw_: [
|
|
152
|
+
{
|
|
153
|
+
op: 'F',
|
|
154
|
+
size: 14.0,
|
|
155
|
+
face: 'Times-Roman',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
op: 'c',
|
|
159
|
+
grad: 'none',
|
|
160
|
+
color: '#0000ff',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
op: 'T',
|
|
164
|
+
pt: [41.0, 157.8],
|
|
165
|
+
align: 'c',
|
|
166
|
+
width: 14.0,
|
|
167
|
+
text: 'n0',
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
fillcolor: 'white',
|
|
171
|
+
fixedsize: 'true',
|
|
172
|
+
fontcolor: 'blue',
|
|
173
|
+
height: '0.5',
|
|
174
|
+
label: '\\N',
|
|
175
|
+
margin: '0',
|
|
176
|
+
pos: '41,162',
|
|
177
|
+
shape: 'circle',
|
|
178
|
+
style: 'filled',
|
|
179
|
+
width: '0.5',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
_gvid: 1,
|
|
183
|
+
name: 'n1',
|
|
184
|
+
Label: 'Another node',
|
|
185
|
+
_draw_: [
|
|
186
|
+
{
|
|
187
|
+
op: 'c',
|
|
188
|
+
grad: 'none',
|
|
189
|
+
color: '#000000',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
op: 'C',
|
|
193
|
+
grad: 'none',
|
|
194
|
+
color: '#ffffff',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
op: 'E',
|
|
198
|
+
rect: [18.0, 90.0, 18.0, 18.0],
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
_ldraw_: [
|
|
202
|
+
{
|
|
203
|
+
op: 'F',
|
|
204
|
+
size: 14.0,
|
|
205
|
+
face: 'Times-Roman',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
op: 'c',
|
|
209
|
+
grad: 'none',
|
|
210
|
+
color: '#0000ff',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
op: 'T',
|
|
214
|
+
pt: [18.0, 85.8],
|
|
215
|
+
align: 'c',
|
|
216
|
+
width: 14.0,
|
|
217
|
+
text: 'n1',
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
fillcolor: 'white',
|
|
221
|
+
fixedsize: 'true',
|
|
222
|
+
fontcolor: 'blue',
|
|
223
|
+
height: '0.5',
|
|
224
|
+
label: '\\N',
|
|
225
|
+
margin: '0',
|
|
226
|
+
pos: '18,90',
|
|
227
|
+
shape: 'circle',
|
|
228
|
+
style: 'filled',
|
|
229
|
+
width: '0.5',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
_gvid: 2,
|
|
233
|
+
name: 'n2',
|
|
234
|
+
Label: 'And a last one',
|
|
235
|
+
_draw_: [
|
|
236
|
+
{
|
|
237
|
+
op: 'c',
|
|
238
|
+
grad: 'none',
|
|
239
|
+
color: '#000000',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
op: 'C',
|
|
243
|
+
grad: 'none',
|
|
244
|
+
color: '#ffffff',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
op: 'E',
|
|
248
|
+
rect: [41.0, 18.0, 18.0, 18.0],
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
_ldraw_: [
|
|
252
|
+
{
|
|
253
|
+
op: 'F',
|
|
254
|
+
size: 14.0,
|
|
255
|
+
face: 'Times-Roman',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
op: 'c',
|
|
259
|
+
grad: 'none',
|
|
260
|
+
color: '#0000ff',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
op: 'T',
|
|
264
|
+
pt: [41.0, 13.8],
|
|
265
|
+
align: 'c',
|
|
266
|
+
width: 14.0,
|
|
267
|
+
text: 'n2',
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
fillcolor: 'white',
|
|
271
|
+
fixedsize: 'true',
|
|
272
|
+
fontcolor: 'blue',
|
|
273
|
+
height: '0.5',
|
|
274
|
+
label: '\\N',
|
|
275
|
+
margin: '0',
|
|
276
|
+
pos: '41,18',
|
|
277
|
+
shape: 'circle',
|
|
278
|
+
style: 'filled',
|
|
279
|
+
width: '0.5',
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
edges: [
|
|
283
|
+
{
|
|
284
|
+
_gvid: 0,
|
|
285
|
+
tail: 0,
|
|
286
|
+
head: 1,
|
|
287
|
+
_draw_: [
|
|
288
|
+
{
|
|
289
|
+
op: 'c',
|
|
290
|
+
grad: 'none',
|
|
291
|
+
color: '#000000',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
op: 'b',
|
|
295
|
+
points: [
|
|
296
|
+
[35.67, 144.76],
|
|
297
|
+
[32.98, 136.58],
|
|
298
|
+
[29.65, 126.45],
|
|
299
|
+
[26.61, 117.2],
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
_hdraw_: [
|
|
304
|
+
{
|
|
305
|
+
op: 'S',
|
|
306
|
+
style: 'solid',
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
op: 'c',
|
|
310
|
+
grad: 'none',
|
|
311
|
+
color: '#000000',
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
op: 'C',
|
|
315
|
+
grad: 'none',
|
|
316
|
+
color: '#000000',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
op: 'P',
|
|
320
|
+
points: [
|
|
321
|
+
[29.91, 116.04],
|
|
322
|
+
[23.47, 107.63],
|
|
323
|
+
[23.26, 118.23],
|
|
324
|
+
],
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
pos: 'e,23.465,107.63 35.666,144.76 32.976,136.58 29.647,126.45 26.607,117.2',
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
_gvid: 1,
|
|
331
|
+
tail: 1,
|
|
332
|
+
head: 2,
|
|
333
|
+
_draw_: [
|
|
334
|
+
{
|
|
335
|
+
op: 'c',
|
|
336
|
+
grad: 'none',
|
|
337
|
+
color: '#000000',
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
op: 'b',
|
|
341
|
+
points: [
|
|
342
|
+
[23.33, 72.76],
|
|
343
|
+
[26.02, 64.58],
|
|
344
|
+
[29.35, 54.45],
|
|
345
|
+
[32.39, 45.2],
|
|
346
|
+
],
|
|
347
|
+
},
|
|
348
|
+
],
|
|
349
|
+
_hdraw_: [
|
|
350
|
+
{
|
|
351
|
+
op: 'S',
|
|
352
|
+
style: 'solid',
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
op: 'c',
|
|
356
|
+
grad: 'none',
|
|
357
|
+
color: '#000000',
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
op: 'C',
|
|
361
|
+
grad: 'none',
|
|
362
|
+
color: '#000000',
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
op: 'P',
|
|
366
|
+
points: [
|
|
367
|
+
[35.74, 46.23],
|
|
368
|
+
[35.53, 35.63],
|
|
369
|
+
[29.09, 44.04],
|
|
370
|
+
],
|
|
371
|
+
},
|
|
372
|
+
],
|
|
373
|
+
pos: 'e,35.535,35.633 23.334,72.765 26.024,64.578 29.353,54.448 32.393,45.195',
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
_gvid: 2,
|
|
377
|
+
tail: 2,
|
|
378
|
+
head: 0,
|
|
379
|
+
_draw_: [
|
|
380
|
+
{
|
|
381
|
+
op: 'c',
|
|
382
|
+
grad: 'none',
|
|
383
|
+
color: '#000000',
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
op: 'b',
|
|
387
|
+
points: [
|
|
388
|
+
[42.62, 36.17],
|
|
389
|
+
[43.52, 46.53],
|
|
390
|
+
[44.55, 60.01],
|
|
391
|
+
[45.0, 72.0],
|
|
392
|
+
[45.6, 87.99],
|
|
393
|
+
[45.6, 92.01],
|
|
394
|
+
[45.0, 108.0],
|
|
395
|
+
[44.69, 116.33],
|
|
396
|
+
[44.09, 125.39],
|
|
397
|
+
[43.46, 133.62],
|
|
398
|
+
],
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
_hdraw_: [
|
|
402
|
+
{
|
|
403
|
+
op: 'S',
|
|
404
|
+
style: 'solid',
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
op: 'c',
|
|
408
|
+
grad: 'none',
|
|
409
|
+
color: '#000000',
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
op: 'C',
|
|
413
|
+
grad: 'none',
|
|
414
|
+
color: '#000000',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
op: 'P',
|
|
418
|
+
points: [
|
|
419
|
+
[39.95, 133.58],
|
|
420
|
+
[42.62, 143.83],
|
|
421
|
+
[46.93, 134.15],
|
|
422
|
+
],
|
|
423
|
+
},
|
|
424
|
+
],
|
|
425
|
+
pos: 'e,42.625,143.83 42.625,36.167 43.524,46.533 44.548,60.013 45,72 45.602,87.989 45.602,92.011 45,108 44.686,116.33 44.095,125.39 43.462,133.62',
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
};
|
|
429
|
+
export var nodeWithMetaData = function (id, name) { return ({
|
|
430
|
+
id: id,
|
|
431
|
+
cumulative: Math.floor(Math.random() * 10),
|
|
432
|
+
meta: {
|
|
433
|
+
location: {
|
|
434
|
+
id: {
|
|
435
|
+
'0': 201,
|
|
436
|
+
'1': 124,
|
|
437
|
+
'2': 147,
|
|
438
|
+
'3': 175,
|
|
439
|
+
'4': 103,
|
|
440
|
+
'5': 42,
|
|
441
|
+
'6': 76,
|
|
442
|
+
'7': 211,
|
|
443
|
+
'8': 186,
|
|
444
|
+
'9': 184,
|
|
445
|
+
'10': 7,
|
|
446
|
+
'11': 19,
|
|
447
|
+
'12': 62,
|
|
448
|
+
'13': 204,
|
|
449
|
+
'14': 76,
|
|
450
|
+
'15': 130,
|
|
451
|
+
},
|
|
452
|
+
address: "".concat(Math.floor(Math.random() * 10)).concat(Math.floor(Math.random() * 10)).concat(Math.floor(Math.random() * 10)),
|
|
453
|
+
mappingId: {
|
|
454
|
+
'0': 72,
|
|
455
|
+
'1': 191,
|
|
456
|
+
'2': 155,
|
|
457
|
+
'3': 45,
|
|
458
|
+
'4': 34,
|
|
459
|
+
'5': 49,
|
|
460
|
+
'6': 65,
|
|
461
|
+
'7': 169,
|
|
462
|
+
'8': 170,
|
|
463
|
+
'9': 93,
|
|
464
|
+
'10': 28,
|
|
465
|
+
'11': 111,
|
|
466
|
+
'12': 102,
|
|
467
|
+
'13': 196,
|
|
468
|
+
'14': 92,
|
|
469
|
+
'15': 210,
|
|
470
|
+
},
|
|
471
|
+
isFolded: false,
|
|
472
|
+
},
|
|
473
|
+
mapping: {
|
|
474
|
+
id: {
|
|
475
|
+
'0': 72,
|
|
476
|
+
'1': 191,
|
|
477
|
+
'2': 155,
|
|
478
|
+
'3': 45,
|
|
479
|
+
'4': 34,
|
|
480
|
+
'5': 49,
|
|
481
|
+
'6': 65,
|
|
482
|
+
'7': 169,
|
|
483
|
+
'8': 170,
|
|
484
|
+
'9': 93,
|
|
485
|
+
'10': 28,
|
|
486
|
+
'11': 111,
|
|
487
|
+
'12': 102,
|
|
488
|
+
'13': 196,
|
|
489
|
+
'14': 92,
|
|
490
|
+
'15': 210,
|
|
491
|
+
},
|
|
492
|
+
start: '0',
|
|
493
|
+
limit: '0',
|
|
494
|
+
offset: '0',
|
|
495
|
+
file: '',
|
|
496
|
+
buildId: '',
|
|
497
|
+
hasFunctions: true,
|
|
498
|
+
hasFilenames: false,
|
|
499
|
+
hasLineNumbers: false,
|
|
500
|
+
hasInlineFrames: false,
|
|
501
|
+
},
|
|
502
|
+
function: {
|
|
503
|
+
id: {
|
|
504
|
+
'0': 46,
|
|
505
|
+
'1': 90,
|
|
506
|
+
'2': 8,
|
|
507
|
+
'3': 65,
|
|
508
|
+
'4': 135,
|
|
509
|
+
'5': 181,
|
|
510
|
+
'6': 65,
|
|
511
|
+
'7': 61,
|
|
512
|
+
'8': 148,
|
|
513
|
+
'9': 246,
|
|
514
|
+
'10': 90,
|
|
515
|
+
'11': 244,
|
|
516
|
+
'12': 208,
|
|
517
|
+
'13': 193,
|
|
518
|
+
'14': 40,
|
|
519
|
+
'15': 177,
|
|
520
|
+
},
|
|
521
|
+
startLine: '0',
|
|
522
|
+
name: name,
|
|
523
|
+
systemName: 'runtime.gopark',
|
|
524
|
+
filename: "/opt/homebrew/Cellar/go/1.18.2/libexec/src/runtime/proc.go/".concat(name),
|
|
525
|
+
},
|
|
526
|
+
line: {
|
|
527
|
+
functionId: {
|
|
528
|
+
'0': 46,
|
|
529
|
+
'1': 90,
|
|
530
|
+
'2': 8,
|
|
531
|
+
'3': 65,
|
|
532
|
+
'4': 135,
|
|
533
|
+
'5': 181,
|
|
534
|
+
'6': 65,
|
|
535
|
+
'7': 61,
|
|
536
|
+
'8': 148,
|
|
537
|
+
'9': 246,
|
|
538
|
+
'10': 90,
|
|
539
|
+
'11': 244,
|
|
540
|
+
'12': 208,
|
|
541
|
+
'13': 193,
|
|
542
|
+
'14': 40,
|
|
543
|
+
'15': 177,
|
|
544
|
+
},
|
|
545
|
+
line: '361',
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
}); };
|
|
549
|
+
export var jsonGraphWithMetaData = {
|
|
550
|
+
total: '4358676',
|
|
551
|
+
nodes: [
|
|
552
|
+
nodeWithMetaData('root', 'root node'),
|
|
553
|
+
nodeWithMetaData('n1', 'normal node'),
|
|
554
|
+
nodeWithMetaData('n2', 'second node'),
|
|
555
|
+
nodeWithMetaData('n3', 'child'),
|
|
556
|
+
],
|
|
557
|
+
edges: [
|
|
558
|
+
{
|
|
559
|
+
id: 'edge1',
|
|
560
|
+
source: 'root',
|
|
561
|
+
target: 'n1',
|
|
562
|
+
cumulative: '10',
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
id: 'edge2',
|
|
566
|
+
source: 'root',
|
|
567
|
+
target: 'n2',
|
|
568
|
+
cumulative: '8',
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
id: 'edge2',
|
|
572
|
+
source: 'n1',
|
|
573
|
+
target: 'n3',
|
|
574
|
+
cumulative: '4',
|
|
575
|
+
},
|
|
576
|
+
],
|
|
577
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CallgraphNode, CallgraphEdge } from '@parca/client';
|
|
2
|
+
export declare const pixelsToInches: (pixels: number) => number;
|
|
3
|
+
export declare const parseEdgePos: ({ pos, xScale, yScale, source, target, nodeRadius, isSelfLoop, }: {
|
|
4
|
+
pos: string;
|
|
5
|
+
xScale?: ((pos: number) => void) | undefined;
|
|
6
|
+
yScale?: ((pos: number) => void) | undefined;
|
|
7
|
+
source?: number[] | undefined;
|
|
8
|
+
target?: number[] | undefined;
|
|
9
|
+
nodeRadius: number;
|
|
10
|
+
isSelfLoop?: boolean | undefined;
|
|
11
|
+
}) => number[];
|
|
12
|
+
export declare const jsonToDot: ({ graph, width, nodeRadius, }: {
|
|
13
|
+
graph: {
|
|
14
|
+
nodes: CallgraphNode[];
|
|
15
|
+
edges: CallgraphEdge[];
|
|
16
|
+
};
|
|
17
|
+
width: number;
|
|
18
|
+
nodeRadius: number;
|
|
19
|
+
}) => string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright 2022 The Parca Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
export var pixelsToInches = function (pixels) { return pixels / 96; };
|
|
23
|
+
export var parseEdgePos = function (_a) {
|
|
24
|
+
var _b;
|
|
25
|
+
var pos = _a.pos, _c = _a.xScale, xScale = _c === void 0 ? function (n) { return n; } : _c, _d = _a.yScale, yScale = _d === void 0 ? function (n) { return n; } : _d, _e = _a.source, source = _e === void 0 ? [] : _e, _f = _a.target, target = _f === void 0 ? [] : _f, nodeRadius = _a.nodeRadius, _g = _a.isSelfLoop, isSelfLoop = _g === void 0 ? false : _g;
|
|
26
|
+
var parts = pos.split(' ');
|
|
27
|
+
var arrow = (_b = parts.shift()) !== null && _b !== void 0 ? _b : '';
|
|
28
|
+
var partsAsArrays = parts.map(function (part) { return part.split(','); });
|
|
29
|
+
var scalePosArray = function (posArr) { return [+xScale(+posArr[0]), +yScale(+posArr[1])]; };
|
|
30
|
+
var _h = partsAsArrays.map(function (posArr) { return scalePosArray(posArr); }), _start = _h[0], cp1 = _h[1], cp2 = _h[2], _end = _h[3];
|
|
31
|
+
var arrowEnd = scalePosArray(arrow.replace('e,', '').split(','));
|
|
32
|
+
var getTargetWithOffset = function (target, lastEdgePoint) {
|
|
33
|
+
var diffX = target[0] - lastEdgePoint[0];
|
|
34
|
+
var diffY = target[1] - lastEdgePoint[1];
|
|
35
|
+
var diffZ = Math.hypot(diffX, diffY);
|
|
36
|
+
var offsetX = (diffX * nodeRadius) / diffZ;
|
|
37
|
+
var offsetY = (diffY * nodeRadius) / diffZ;
|
|
38
|
+
return [target[0] - offsetX, target[1] - offsetY];
|
|
39
|
+
};
|
|
40
|
+
if (isSelfLoop) {
|
|
41
|
+
var sourceX = source[0], sourceY = source[1];
|
|
42
|
+
var targetX = target[0], targetY = target[1];
|
|
43
|
+
return [
|
|
44
|
+
sourceX,
|
|
45
|
+
sourceY + nodeRadius,
|
|
46
|
+
sourceX,
|
|
47
|
+
sourceY + 3 * nodeRadius,
|
|
48
|
+
targetX + 5 * nodeRadius,
|
|
49
|
+
targetY,
|
|
50
|
+
targetX + nodeRadius,
|
|
51
|
+
targetY,
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], source, true), cp1, true), cp2, true), getTargetWithOffset(target, arrowEnd), true);
|
|
55
|
+
};
|
|
56
|
+
export var jsonToDot = function (_a) {
|
|
57
|
+
var graph = _a.graph, width = _a.width, nodeRadius = _a.nodeRadius;
|
|
58
|
+
var nodes = graph.nodes, edges = graph.edges;
|
|
59
|
+
var objectAsDotAttributes = function (obj) {
|
|
60
|
+
return Object.entries(obj)
|
|
61
|
+
.map(function (entry) { return "".concat(entry[0], "=\"").concat(entry[1], "\""); })
|
|
62
|
+
.join(' ');
|
|
63
|
+
};
|
|
64
|
+
var nodesAsStrings = nodes.map(function (node) {
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
66
|
+
var dataAttributes = {
|
|
67
|
+
address: (_c = (_b = (_a = node.meta) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.address) !== null && _c !== void 0 ? _c : '',
|
|
68
|
+
functionName: (_f = (_e = (_d = node.meta) === null || _d === void 0 ? void 0 : _d.function) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '',
|
|
69
|
+
cumulative: (_g = node.cumulative) !== null && _g !== void 0 ? _g : '',
|
|
70
|
+
root: (node.id === 'root').toString(),
|
|
71
|
+
};
|
|
72
|
+
return "\"".concat(node.id, "\" [").concat(objectAsDotAttributes(dataAttributes), "]");
|
|
73
|
+
});
|
|
74
|
+
var edgesAsStrings = edges.map(function (edge) {
|
|
75
|
+
var dataAttributes = {
|
|
76
|
+
cumulative: edge.cumulative,
|
|
77
|
+
};
|
|
78
|
+
return "\"".concat(edge.source, "\" -> \"").concat(edge.target, "\" [").concat(objectAsDotAttributes(dataAttributes), "]");
|
|
79
|
+
});
|
|
80
|
+
var graphAsDot = "digraph \"callgraph\" {\n rankdir=\"TB\"\n ratio=\"1,3\"\n size=\"".concat(pixelsToInches(width), ", ").concat(pixelsToInches(width), "!\"\n margin=10\n edge [margin=0]\n node [margin=0 width=").concat(nodeRadius, "]\n ").concat(nodesAsStrings.join(' '), "\n ").concat(edgesAsStrings.join(' '), "\n }");
|
|
81
|
+
return graphAsDot;
|
|
82
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CallgraphNode, FlamegraphRootNode } from '@parca/client';
|
|
2
|
+
interface GraphTooltipProps {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
unit: string;
|
|
6
|
+
total: number;
|
|
7
|
+
hoveringNode: HoveringNode;
|
|
8
|
+
contextElement: Element | null;
|
|
9
|
+
isFixed?: boolean;
|
|
10
|
+
virtualContextElement?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface HoveringNode extends CallgraphNode, FlamegraphRootNode {
|
|
13
|
+
diff: string;
|
|
14
|
+
meta?: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
declare const GraphTooltip: ({ x, y, unit, total, hoveringNode, contextElement, isFixed, virtualContextElement, }: GraphTooltipProps) => JSX.Element;
|
|
19
|
+
export default GraphTooltip;
|