@parca/profile 0.17.1 → 0.17.3

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.d.ts +1 -2
  3. package/dist/GraphTooltipArrow/Content.d.ts.map +1 -1
  4. package/dist/GraphTooltipArrow/Content.js +1 -2
  5. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.d.ts +1 -2
  6. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.d.ts.map +1 -1
  7. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +1 -2
  8. package/dist/GraphTooltipArrow/useGraphTooltip/index.d.ts +1 -2
  9. package/dist/GraphTooltipArrow/useGraphTooltip/index.d.ts.map +1 -1
  10. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +2 -2
  11. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts +2 -6
  12. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts.map +1 -1
  13. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.js +4 -5
  14. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.d.ts +20 -0
  15. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.d.ts.map +1 -0
  16. package/{src/Callgraph/constants.ts → dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.js} +12 -3
  17. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts +8 -51
  18. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts.map +1 -1
  19. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.js +59 -136
  20. package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.d.ts +8 -0
  21. package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.d.ts.map +1 -0
  22. package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.js +40 -0
  23. package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.d.ts +32 -0
  24. package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.d.ts.map +1 -0
  25. package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.js +40 -0
  26. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts +4 -5
  27. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts.map +1 -1
  28. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +62 -76
  29. package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.d.ts +3 -3
  30. package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.d.ts.map +1 -1
  31. package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.js +9 -7
  32. package/dist/ProfileIcicleGraph/index.d.ts +3 -6
  33. package/dist/ProfileIcicleGraph/index.d.ts.map +1 -1
  34. package/dist/ProfileIcicleGraph/index.js +8 -17
  35. package/dist/ProfileView/components/DashboardItems/index.d.ts +3 -5
  36. package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
  37. package/dist/ProfileView/components/DashboardItems/index.js +4 -9
  38. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  39. package/dist/ProfileView/components/Toolbars/index.js +1 -2
  40. package/dist/ProfileView/index.d.ts +1 -1
  41. package/dist/ProfileView/index.d.ts.map +1 -1
  42. package/dist/ProfileView/index.js +1 -13
  43. package/dist/ProfileView/types/visualization.d.ts +1 -1
  44. package/dist/ProfileView/types/visualization.d.ts.map +1 -1
  45. package/dist/index.d.ts +0 -4
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +0 -2
  48. package/dist/styles.css +1 -1
  49. package/package.json +5 -5
  50. package/src/GraphTooltipArrow/Content.tsx +0 -3
  51. package/src/GraphTooltipArrow/DockedGraphTooltip/index.tsx +0 -3
  52. package/src/GraphTooltipArrow/useGraphTooltip/index.ts +1 -3
  53. package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx +5 -13
  54. package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.tsx +53 -0
  55. package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +96 -310
  56. package/src/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.tsx +78 -0
  57. package/src/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.tsx +93 -0
  58. package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +108 -216
  59. package/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +8 -15
  60. package/src/ProfileIcicleGraph/index.tsx +7 -38
  61. package/src/ProfileView/components/DashboardItems/index.tsx +2 -27
  62. package/src/ProfileView/components/Toolbars/index.tsx +0 -2
  63. package/src/ProfileView/index.tsx +0 -14
  64. package/src/ProfileView/types/visualization.ts +1 -1
  65. package/src/index.tsx +0 -5
  66. package/dist/Callgraph/constants.d.ts +0 -3
  67. package/dist/Callgraph/constants.d.ts.map +0 -1
  68. package/dist/Callgraph/constants.js +0 -14
  69. package/dist/Callgraph/index.d.ts +0 -11
  70. package/dist/Callgraph/index.d.ts.map +0 -1
  71. package/dist/Callgraph/index.js +0 -104
  72. package/dist/Callgraph/mockData/index.d.ts +0 -149
  73. package/dist/Callgraph/mockData/index.d.ts.map +0 -1
  74. package/dist/Callgraph/mockData/index.js +0 -594
  75. package/dist/Callgraph/utils.d.ts +0 -20
  76. package/dist/Callgraph/utils.d.ts.map +0 -1
  77. package/dist/Callgraph/utils.js +0 -97
  78. package/dist/GraphTooltip/ExpandOnHoverValue.d.ts +0 -7
  79. package/dist/GraphTooltip/ExpandOnHoverValue.d.ts.map +0 -1
  80. package/dist/GraphTooltip/ExpandOnHoverValue.js +0 -4
  81. package/dist/GraphTooltip/index.d.ts +0 -41
  82. package/dist/GraphTooltip/index.d.ts.map +0 -1
  83. package/dist/GraphTooltip/index.js +0 -201
  84. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.d.ts +0 -6
  85. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.d.ts.map +0 -1
  86. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.js +0 -59
  87. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.d.ts +0 -47
  88. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.d.ts.map +0 -1
  89. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.js +0 -93
  90. package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts +0 -14
  91. package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts.map +0 -1
  92. package/dist/ProfileIcicleGraph/IcicleGraph/index.js +0 -48
  93. package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.d.ts +0 -15
  94. package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.d.ts.map +0 -1
  95. package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.js +0 -57
  96. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.d.ts +0 -8
  97. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.d.ts.map +0 -1
  98. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.js +0 -32
  99. package/dist/ProfileIcicleGraph/IcicleGraph/utils.d.ts +0 -7
  100. package/dist/ProfileIcicleGraph/IcicleGraph/utils.d.ts.map +0 -1
  101. package/dist/ProfileIcicleGraph/IcicleGraph/utils.js +0 -66
  102. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.d.ts +0 -9
  103. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.d.ts.map +0 -1
  104. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.js +0 -45
  105. package/dist/ProfileView/hooks/useGraphviz.d.ts +0 -12
  106. package/dist/ProfileView/hooks/useGraphviz.d.ts.map +0 -1
  107. package/dist/ProfileView/hooks/useGraphviz.js +0 -42
  108. package/src/Callgraph/index.tsx +0 -177
  109. package/src/Callgraph/mockData/index.ts +0 -605
  110. package/src/Callgraph/utils.ts +0 -141
  111. package/src/GraphTooltip/ExpandOnHoverValue.tsx +0 -30
  112. package/src/GraphTooltip/index.tsx +0 -509
  113. package/src/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.tsx +0 -96
  114. package/src/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.tsx +0 -266
  115. package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +0 -123
  116. package/src/ProfileIcicleGraph/IcicleGraph/useColoredGraph.ts +0 -117
  117. package/src/ProfileIcicleGraph/IcicleGraph/useNodeColor.ts +0 -54
  118. package/src/ProfileIcicleGraph/IcicleGraph/utils.ts +0 -102
  119. package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.tsx +0 -130
  120. package/src/ProfileView/hooks/useGraphviz.ts +0 -69
@@ -1,594 +0,0 @@
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 const dotGraph = `{
14
- n1 [Label = "n1"];
15
- n2 [Label = "n2"];
16
- n3 [Label = "n3"];
17
- n1 -- n2;
18
- n1 -- n3;
19
- n2 -- n2;
20
- }`;
21
- export const jsonGraph = {
22
- total: '4358676',
23
- unit: 'count',
24
- nodes: [
25
- {
26
- id: 'n0',
27
- label: 'A node',
28
- value: 30,
29
- },
30
- {
31
- id: 'n1',
32
- label: 'Another node',
33
- value: 20,
34
- },
35
- {
36
- id: 'n2',
37
- label: 'And a last one',
38
- value: 10,
39
- },
40
- {
41
- id: 'n3',
42
- label: 'n3',
43
- value: 2,
44
- },
45
- {
46
- id: 'n4',
47
- label: 'n4',
48
- value: 1,
49
- },
50
- {
51
- id: 'n5',
52
- label: 'n5',
53
- value: 1,
54
- },
55
- ],
56
- edges: [
57
- {
58
- id: 'e0',
59
- source: 'n0',
60
- target: 'n1',
61
- label: 'edge 1',
62
- },
63
- {
64
- id: 'e1',
65
- source: 'n1',
66
- target: 'n2',
67
- label: 'edge 2',
68
- },
69
- {
70
- id: 'e2',
71
- source: 'n2',
72
- target: 'n0',
73
- label: 'edge 3',
74
- },
75
- {
76
- id: 'e3',
77
- source: 'n0',
78
- target: 'n2',
79
- label: 'edge 4',
80
- },
81
- {
82
- id: 'e4',
83
- source: 'n2',
84
- target: 'n3',
85
- label: 'edge 5',
86
- },
87
- {
88
- id: 'e5',
89
- source: 'n3',
90
- target: 'n4',
91
- label: 'edge 6',
92
- },
93
- {
94
- id: 'e5',
95
- source: 'n4',
96
- target: 'n5',
97
- label: 'edge 6',
98
- },
99
- {
100
- id: 'e5',
101
- source: 'n3',
102
- target: 'n5',
103
- label: 'edge 6',
104
- },
105
- ],
106
- };
107
- // just a string, doesn't need to be on separate lines
108
- export const graphvizDot = `
109
- digraph {
110
- N1 [id="node1"]
111
- N2 [id="node2"]
112
- N3 [id="node3"]
113
- N4 [id="node4"]
114
- N1 -> N2 [id="e1" label="e1 fdskjao fdjksaol"]
115
- N2 -> N3 [id="e2" label="e2"]
116
- N3 -> N4 [id="e3" label="e3"]
117
- N3 -> N1 [id="e4" label="e4"]
118
- }`;
119
- export const jsonGraphWithGraphvizPositions = {
120
- name: '%27',
121
- directed: true,
122
- strict: false,
123
- _draw_: [
124
- {
125
- op: 'c',
126
- grad: 'none',
127
- color: '#fffffe00',
128
- },
129
- {
130
- op: 'C',
131
- grad: 'none',
132
- color: '#ffffff',
133
- },
134
- {
135
- op: 'P',
136
- points: [
137
- [0.0, 0.0],
138
- [0.0, 180.0],
139
- [59.0, 180.0],
140
- [59.0, 0.0],
141
- ],
142
- },
143
- ],
144
- bb: '0,0,59,180',
145
- xdotversion: '1.7',
146
- _subgraph_cnt: 0,
147
- objects: [
148
- {
149
- _gvid: 0,
150
- name: 'n0',
151
- Label: 'A node',
152
- _draw_: [
153
- {
154
- op: 'c',
155
- grad: 'none',
156
- color: '#000000',
157
- },
158
- {
159
- op: 'C',
160
- grad: 'none',
161
- color: '#ffffff',
162
- },
163
- {
164
- op: 'E',
165
- rect: [41.0, 162.0, 18.0, 18.0],
166
- },
167
- ],
168
- _ldraw_: [
169
- {
170
- op: 'F',
171
- size: 14.0,
172
- face: 'Times-Roman',
173
- },
174
- {
175
- op: 'c',
176
- grad: 'none',
177
- color: '#0000ff',
178
- },
179
- {
180
- op: 'T',
181
- pt: [41.0, 157.8],
182
- align: 'c',
183
- width: 14.0,
184
- text: 'n0',
185
- },
186
- ],
187
- fillcolor: 'white',
188
- fixedsize: 'true',
189
- fontcolor: 'blue',
190
- height: '0.5',
191
- label: '\\N',
192
- margin: '0',
193
- pos: '41,162',
194
- shape: 'circle',
195
- style: 'filled',
196
- width: '0.5',
197
- },
198
- {
199
- _gvid: 1,
200
- name: 'n1',
201
- Label: 'Another node',
202
- _draw_: [
203
- {
204
- op: 'c',
205
- grad: 'none',
206
- color: '#000000',
207
- },
208
- {
209
- op: 'C',
210
- grad: 'none',
211
- color: '#ffffff',
212
- },
213
- {
214
- op: 'E',
215
- rect: [18.0, 90.0, 18.0, 18.0],
216
- },
217
- ],
218
- _ldraw_: [
219
- {
220
- op: 'F',
221
- size: 14.0,
222
- face: 'Times-Roman',
223
- },
224
- {
225
- op: 'c',
226
- grad: 'none',
227
- color: '#0000ff',
228
- },
229
- {
230
- op: 'T',
231
- pt: [18.0, 85.8],
232
- align: 'c',
233
- width: 14.0,
234
- text: 'n1',
235
- },
236
- ],
237
- fillcolor: 'white',
238
- fixedsize: 'true',
239
- fontcolor: 'blue',
240
- height: '0.5',
241
- label: '\\N',
242
- margin: '0',
243
- pos: '18,90',
244
- shape: 'circle',
245
- style: 'filled',
246
- width: '0.5',
247
- },
248
- {
249
- _gvid: 2,
250
- name: 'n2',
251
- Label: 'And a last one',
252
- _draw_: [
253
- {
254
- op: 'c',
255
- grad: 'none',
256
- color: '#000000',
257
- },
258
- {
259
- op: 'C',
260
- grad: 'none',
261
- color: '#ffffff',
262
- },
263
- {
264
- op: 'E',
265
- rect: [41.0, 18.0, 18.0, 18.0],
266
- },
267
- ],
268
- _ldraw_: [
269
- {
270
- op: 'F',
271
- size: 14.0,
272
- face: 'Times-Roman',
273
- },
274
- {
275
- op: 'c',
276
- grad: 'none',
277
- color: '#0000ff',
278
- },
279
- {
280
- op: 'T',
281
- pt: [41.0, 13.8],
282
- align: 'c',
283
- width: 14.0,
284
- text: 'n2',
285
- },
286
- ],
287
- fillcolor: 'white',
288
- fixedsize: 'true',
289
- fontcolor: 'blue',
290
- height: '0.5',
291
- label: '\\N',
292
- margin: '0',
293
- pos: '41,18',
294
- shape: 'circle',
295
- style: 'filled',
296
- width: '0.5',
297
- },
298
- ],
299
- edges: [
300
- {
301
- _gvid: 0,
302
- tail: 0,
303
- head: 1,
304
- _draw_: [
305
- {
306
- op: 'c',
307
- grad: 'none',
308
- color: '#000000',
309
- },
310
- {
311
- op: 'b',
312
- points: [
313
- [35.67, 144.76],
314
- [32.98, 136.58],
315
- [29.65, 126.45],
316
- [26.61, 117.2],
317
- ],
318
- },
319
- ],
320
- _hdraw_: [
321
- {
322
- op: 'S',
323
- style: 'solid',
324
- },
325
- {
326
- op: 'c',
327
- grad: 'none',
328
- color: '#000000',
329
- },
330
- {
331
- op: 'C',
332
- grad: 'none',
333
- color: '#000000',
334
- },
335
- {
336
- op: 'P',
337
- points: [
338
- [29.91, 116.04],
339
- [23.47, 107.63],
340
- [23.26, 118.23],
341
- ],
342
- },
343
- ],
344
- pos: 'e,23.465,107.63 35.666,144.76 32.976,136.58 29.647,126.45 26.607,117.2',
345
- },
346
- {
347
- _gvid: 1,
348
- tail: 1,
349
- head: 2,
350
- _draw_: [
351
- {
352
- op: 'c',
353
- grad: 'none',
354
- color: '#000000',
355
- },
356
- {
357
- op: 'b',
358
- points: [
359
- [23.33, 72.76],
360
- [26.02, 64.58],
361
- [29.35, 54.45],
362
- [32.39, 45.2],
363
- ],
364
- },
365
- ],
366
- _hdraw_: [
367
- {
368
- op: 'S',
369
- style: 'solid',
370
- },
371
- {
372
- op: 'c',
373
- grad: 'none',
374
- color: '#000000',
375
- },
376
- {
377
- op: 'C',
378
- grad: 'none',
379
- color: '#000000',
380
- },
381
- {
382
- op: 'P',
383
- points: [
384
- [35.74, 46.23],
385
- [35.53, 35.63],
386
- [29.09, 44.04],
387
- ],
388
- },
389
- ],
390
- pos: 'e,35.535,35.633 23.334,72.765 26.024,64.578 29.353,54.448 32.393,45.195',
391
- },
392
- {
393
- _gvid: 2,
394
- tail: 2,
395
- head: 0,
396
- _draw_: [
397
- {
398
- op: 'c',
399
- grad: 'none',
400
- color: '#000000',
401
- },
402
- {
403
- op: 'b',
404
- points: [
405
- [42.62, 36.17],
406
- [43.52, 46.53],
407
- [44.55, 60.01],
408
- [45.0, 72.0],
409
- [45.6, 87.99],
410
- [45.6, 92.01],
411
- [45.0, 108.0],
412
- [44.69, 116.33],
413
- [44.09, 125.39],
414
- [43.46, 133.62],
415
- ],
416
- },
417
- ],
418
- _hdraw_: [
419
- {
420
- op: 'S',
421
- style: 'solid',
422
- },
423
- {
424
- op: 'c',
425
- grad: 'none',
426
- color: '#000000',
427
- },
428
- {
429
- op: 'C',
430
- grad: 'none',
431
- color: '#000000',
432
- },
433
- {
434
- op: 'P',
435
- points: [
436
- [39.95, 133.58],
437
- [42.62, 143.83],
438
- [46.93, 134.15],
439
- ],
440
- },
441
- ],
442
- 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',
443
- },
444
- ],
445
- };
446
- export const nodeWithMetaData = (id, name) => ({
447
- id,
448
- cumulative: Math.floor(Math.random() * 10),
449
- meta: {
450
- location: {
451
- id: {
452
- '0': 201,
453
- '1': 124,
454
- '2': 147,
455
- '3': 175,
456
- '4': 103,
457
- '5': 42,
458
- '6': 76,
459
- '7': 211,
460
- '8': 186,
461
- '9': 184,
462
- '10': 7,
463
- '11': 19,
464
- '12': 62,
465
- '13': 204,
466
- '14': 76,
467
- '15': 130,
468
- },
469
- address: `${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}`,
470
- mappingId: {
471
- '0': 72,
472
- '1': 191,
473
- '2': 155,
474
- '3': 45,
475
- '4': 34,
476
- '5': 49,
477
- '6': 65,
478
- '7': 169,
479
- '8': 170,
480
- '9': 93,
481
- '10': 28,
482
- '11': 111,
483
- '12': 102,
484
- '13': 196,
485
- '14': 92,
486
- '15': 210,
487
- },
488
- isFolded: false,
489
- },
490
- mapping: {
491
- id: {
492
- '0': 72,
493
- '1': 191,
494
- '2': 155,
495
- '3': 45,
496
- '4': 34,
497
- '5': 49,
498
- '6': 65,
499
- '7': 169,
500
- '8': 170,
501
- '9': 93,
502
- '10': 28,
503
- '11': 111,
504
- '12': 102,
505
- '13': 196,
506
- '14': 92,
507
- '15': 210,
508
- },
509
- start: '0',
510
- limit: '0',
511
- offset: '0',
512
- file: '',
513
- buildId: '',
514
- hasFunctions: true,
515
- hasFilenames: false,
516
- hasLineNumbers: false,
517
- hasInlineFrames: false,
518
- },
519
- function: {
520
- id: {
521
- '0': 46,
522
- '1': 90,
523
- '2': 8,
524
- '3': 65,
525
- '4': 135,
526
- '5': 181,
527
- '6': 65,
528
- '7': 61,
529
- '8': 148,
530
- '9': 246,
531
- '10': 90,
532
- '11': 244,
533
- '12': 208,
534
- '13': 193,
535
- '14': 40,
536
- '15': 177,
537
- },
538
- startLine: '0',
539
- name,
540
- systemName: 'runtime.gopark',
541
- filename: `/opt/homebrew/Cellar/go/1.18.2/libexec/src/runtime/proc.go/${name}`,
542
- },
543
- line: {
544
- functionId: {
545
- '0': 46,
546
- '1': 90,
547
- '2': 8,
548
- '3': 65,
549
- '4': 135,
550
- '5': 181,
551
- '6': 65,
552
- '7': 61,
553
- '8': 148,
554
- '9': 246,
555
- '10': 90,
556
- '11': 244,
557
- '12': 208,
558
- '13': 193,
559
- '14': 40,
560
- '15': 177,
561
- },
562
- line: '361',
563
- },
564
- },
565
- });
566
- export const jsonGraphWithMetaData = {
567
- total: '4358676',
568
- nodes: [
569
- nodeWithMetaData('root', 'root node'),
570
- nodeWithMetaData('n1', 'normal node'),
571
- nodeWithMetaData('n2', 'second node'),
572
- nodeWithMetaData('n3', 'child'),
573
- ],
574
- edges: [
575
- {
576
- id: 'edge1',
577
- source: 'root',
578
- target: 'n1',
579
- cumulative: '10',
580
- },
581
- {
582
- id: 'edge2',
583
- source: 'root',
584
- target: 'n2',
585
- cumulative: '8',
586
- },
587
- {
588
- id: 'edge2',
589
- source: 'n1',
590
- target: 'n3',
591
- cumulative: '4',
592
- },
593
- ],
594
- };
@@ -1,20 +0,0 @@
1
- import { CallgraphEdge, CallgraphNode } from '@parca/client';
2
- export declare const pixelsToInches: (pixels: number) => number;
3
- export declare const getCurvePoints: ({ pos, xScale, yScale, source, target, offset, isSelfLoop, }: {
4
- pos: string;
5
- xScale?: (pos: number) => number;
6
- yScale?: (pos: number) => number;
7
- source?: number[];
8
- target?: number[];
9
- isSelfLoop?: boolean;
10
- offset?: number;
11
- }) => number[];
12
- export declare const jsonToDot: ({ graph, colorRange, }: {
13
- graph: {
14
- nodes: CallgraphNode[];
15
- edges: CallgraphEdge[];
16
- };
17
- width: number;
18
- colorRange: [string, string];
19
- }) => string;
20
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/Callgraph/utils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAE3D,eAAO,MAAM,cAAc,WAAY,MAAM,KAAG,MAAqB,CAAC;AAEtE,eAAO,MAAM,cAAc,iEAQxB;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KAAG,MAAM,EA2CT,CAAC;AAOF,eAAO,MAAM,SAAS,2BAGnB;IACD,KAAK,EAAE;QAAC,KAAK,EAAE,aAAa,EAAE,CAAC;QAAC,KAAK,EAAE,aAAa,EAAE,CAAA;KAAC,CAAC;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,KAAG,MA+CH,CAAC"}
@@ -1,97 +0,0 @@
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
- import * as d3 from 'd3';
14
- import { withAlphaHex } from 'with-alpha-hex';
15
- export const pixelsToInches = (pixels) => pixels / 96;
16
- export const getCurvePoints = ({ pos, xScale = n => n, yScale = n => n, source = [], target = [], offset = 0, isSelfLoop = false, }) => {
17
- if (isSelfLoop) {
18
- const [sourceX, sourceY] = source;
19
- const [targetX, targetY] = target;
20
- return [
21
- sourceX,
22
- sourceY + offset,
23
- sourceX,
24
- sourceY + 3 * offset,
25
- targetX + 5 * offset,
26
- targetY,
27
- targetX + offset,
28
- targetY,
29
- ];
30
- }
31
- // graphviz pos format is in format 'endpoint,startpoint,triple(cp1,cp2,end),...triple...'
32
- const scalePoint = (point) => [xScale(point[0]), yScale(point[1])];
33
- const strAsNumArray = (string) => string
34
- .replace('e,', '')
35
- .split(',')
36
- .map(str => Number(str));
37
- const getLastPointWithOffset = (target, last, offset) => {
38
- const [targetX, targetY] = target;
39
- const [lastX, lastY] = last;
40
- const diffX = targetX - lastX;
41
- const diffY = targetY - lastY;
42
- const diffZ = Math.hypot(diffX, diffY);
43
- const offsetX = (diffX * offset) / diffZ;
44
- const offsetY = (diffY * offset) / diffZ;
45
- return [targetX - offsetX, targetY - offsetY];
46
- };
47
- const points = pos.split(' ').map(str => strAsNumArray(str));
48
- const scaledPoints = points.map(point => scalePoint(point));
49
- const lastPointIndex = scaledPoints.length - 1;
50
- const lastPointWithOffset = getLastPointWithOffset(target, scaledPoints[lastPointIndex], offset);
51
- return [source, ...scaledPoints.slice(2, points.length - 1), lastPointWithOffset].flat();
52
- };
53
- const objectAsDotAttributes = (obj) => Object.entries(obj)
54
- .map(entry => `${entry[0]}="${entry[1]}"`)
55
- .join(' ');
56
- export const jsonToDot = ({ graph, colorRange, }) => {
57
- const { nodes, edges } = graph;
58
- const cumulatives = edges.map((edge) => Number(edge.cumulative));
59
- const cumulativesRange = d3.extent(cumulatives);
60
- const colorScale = d3
61
- .scaleSequentialLog(d3.interpolateBlues)
62
- .domain(cumulativesRange)
63
- .range(colorRange);
64
- const colorOpacityScale = d3.scaleLinear().domain(cumulativesRange).range([0.5, 1]);
65
- const nodesAsStrings = nodes.map((node) => {
66
- const rgbColor = colorScale(Number(node.cumulative));
67
- const hexColor = d3.color(rgbColor)?.formatHex() ?? 'red';
68
- const dataAttributes = {
69
- label: node.meta?.function?.name.substring(0, 12) ?? '',
70
- root: (node.id === 'root').toString(),
71
- fillcolor: hexColor,
72
- className: 'node',
73
- id: node.id,
74
- };
75
- return `"${node.id}" [${objectAsDotAttributes(dataAttributes)}]`;
76
- });
77
- const edgesAsStrings = edges.map((edge) => {
78
- const dataAttributes = {
79
- cumulative: Number(edge.cumulative),
80
- color: withAlphaHex(colorRange[1], colorOpacityScale(Number(edge.cumulative))),
81
- className: 'edge',
82
- // boxHeight: DEFAULT_NODE_HEIGHT,
83
- };
84
- return `"${edge.source}" -> "${edge.target}" [${objectAsDotAttributes(dataAttributes)}]`;
85
- });
86
- const graphAsDot = `digraph "callgraph" {
87
- rankdir="TB"
88
- overlap="prism"
89
- ratio="1,3"
90
- margin=15
91
- edge [margin=0]
92
- node [shape=box style="rounded,filled"]
93
- ${nodesAsStrings.join(' ')}
94
- ${edgesAsStrings.join(' ')}
95
- }`;
96
- return graphAsDot;
97
- };