@parca/profile 0.16.183 → 0.16.185
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 +8 -0
- package/dist/Callgraph/constants.js +2 -2
- package/dist/Callgraph/index.js +35 -45
- package/dist/Callgraph/mockData/index.js +28 -11
- package/dist/Callgraph/utils.js +51 -58
- package/dist/GraphTooltip/ExpandOnHoverValue.js +2 -14
- package/dist/GraphTooltip/index.d.ts +5 -5
- package/dist/GraphTooltip/index.js +96 -122
- package/dist/MatchersInput/SuggestionItem.js +5 -17
- package/dist/MatchersInput/SuggestionsList.js +29 -53
- package/dist/MatchersInput/index.js +58 -74
- package/dist/MetricsCircle/index.js +2 -16
- package/dist/MetricsGraph/MetricsTooltip/index.js +27 -53
- package/dist/MetricsGraph/index.js +79 -98
- package/dist/MetricsSeries/index.js +4 -19
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +4 -16
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +2 -14
- package/dist/ProfileExplorer/index.js +129 -88
- package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.js +15 -31
- package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.d.ts +4 -4
- package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.js +38 -54
- package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts +2 -2
- package/dist/ProfileIcicleGraph/IcicleGraph/index.js +15 -31
- package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.js +22 -26
- package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.js +8 -9
- package/dist/ProfileIcicleGraph/IcicleGraph/utils.js +18 -20
- package/dist/ProfileIcicleGraph/index.d.ts +2 -2
- package/dist/ProfileIcicleGraph/index.js +18 -30
- package/dist/ProfileMetricsGraph/index.js +36 -88
- package/dist/ProfileSelector/CompareButton.js +8 -20
- package/dist/ProfileSelector/index.js +69 -69
- package/dist/ProfileSource.js +56 -65
- package/dist/ProfileTypeSelector/index.js +14 -28
- package/dist/ProfileView/FilterByFunctionButton.js +6 -7
- package/dist/ProfileView/ViewSelector.js +18 -31
- package/dist/ProfileView/VisualizationPanel.js +4 -16
- package/dist/ProfileView/index.d.ts +2 -1
- package/dist/ProfileView/index.js +73 -151
- package/dist/ProfileViewWithData.js +50 -97
- package/dist/TopTable/index.js +55 -63
- package/dist/components/DiffLegend.js +16 -28
- package/dist/components/ProfileShareButton/ResultBox.js +7 -21
- package/dist/components/ProfileShareButton/index.js +31 -90
- package/dist/useDelayedLoader.js +7 -8
- package/dist/useGrpcQuery/index.js +6 -48
- package/dist/useQuery.js +14 -58
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +16 -68
- package/package.json +6 -6
- package/src/Callgraph/index.tsx +3 -3
- package/src/Callgraph/utils.ts +1 -1
- package/src/GraphTooltip/index.tsx +17 -17
- package/src/MetricsGraph/index.tsx +3 -3
- package/src/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.tsx +9 -10
- package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +4 -8
- package/src/ProfileIcicleGraph/IcicleGraph/useNodeColor.ts +2 -2
- package/src/ProfileIcicleGraph/index.tsx +8 -8
- package/src/ProfileView/index.tsx +8 -3
- package/src/ProfileViewWithData.tsx +5 -0
- package/src/TopTable/index.tsx +3 -3
- package/src/utils.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.16.185](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.184...@parca/profile@0.16.185) (2023-06-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.16.184](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.183...@parca/profile@0.16.184) (2023-06-15)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.16.183](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.182...@parca/profile@0.16.183) (2023-06-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export const DEFAULT_NODE_HEIGHT = 20;
|
|
14
|
+
export const GRAPH_MARGIN = 15;
|
package/dist/Callgraph/index.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
// Copyright 2022 The Parca Authors
|
|
14
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -31,19 +20,18 @@ import { Button, useKeyDown, useURLState } from '@parca/components';
|
|
|
31
20
|
import { selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector } from '@parca/store';
|
|
32
21
|
import { getNewSpanColor } from '@parca/utilities';
|
|
33
22
|
import GraphTooltip from '../GraphTooltip';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var originalView = {
|
|
23
|
+
const Callgraph = ({ data, svgString, sampleUnit, width }) => {
|
|
24
|
+
const originalView = {
|
|
37
25
|
scale: 1,
|
|
38
26
|
translation: { x: 0, y: 0 },
|
|
39
27
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
const [view, setView] = useState(originalView);
|
|
29
|
+
const containerRef = useRef(null);
|
|
30
|
+
const svgRef = useRef(null);
|
|
31
|
+
const svgWrapper = useRef(null);
|
|
32
|
+
const [svgWrapperLoaded, setSvgWrapperLoaded] = useState(false);
|
|
33
|
+
const dispatch = useAppDispatch();
|
|
34
|
+
const { isShiftDown } = useKeyDown();
|
|
47
35
|
// TODO: implement highlighting nodes on user search
|
|
48
36
|
// const currentSearchString = (selectQueryParam('search_string') as string) ?? '';
|
|
49
37
|
// const isSearchEmpty = currentSearchString === undefined || currentSearchString === '';
|
|
@@ -51,41 +39,43 @@ var Callgraph = function (_a) {
|
|
|
51
39
|
// ? true
|
|
52
40
|
// : isSearchMatch(currentSearchString, sourceNode.functionName) &&
|
|
53
41
|
// isSearchMatch(currentSearchString, targetNode.functionName);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
const [rawDashboardItems] = useURLState({ param: 'dashboard_items' });
|
|
43
|
+
const dashboardItems = rawDashboardItems !== undefined ? rawDashboardItems : ['icicle'];
|
|
44
|
+
const isDarkMode = useAppSelector(selectDarkMode);
|
|
45
|
+
const maxColor = getNewSpanColor(isDarkMode);
|
|
46
|
+
const minColor = d3.scaleLinear([isDarkMode ? 'black' : 'white', maxColor])(0.3);
|
|
47
|
+
const colorRange = [minColor, maxColor];
|
|
48
|
+
const cumulatives = data.edges.map((edge) => edge.cumulative.toString());
|
|
49
|
+
const cumulativesRange = d3.extent(cumulatives);
|
|
50
|
+
const colorScale = d3
|
|
63
51
|
.scaleSequentialLog(d3.interpolateBlues)
|
|
64
52
|
.domain([Number(cumulativesRange[0]), Number(cumulativesRange[1])])
|
|
65
53
|
.range(colorRange);
|
|
66
|
-
useEffect(
|
|
54
|
+
useEffect(() => {
|
|
67
55
|
setSvgWrapperLoaded(true);
|
|
68
56
|
}, []);
|
|
69
|
-
useEffect(
|
|
57
|
+
useEffect(() => {
|
|
70
58
|
if (svgWrapperLoaded && svgRef.current !== null) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
const addInteraction = () => {
|
|
60
|
+
const svg = d3.select(svgRef.current);
|
|
61
|
+
const nodes = svg.selectAll('.node');
|
|
74
62
|
nodes.each(function () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return n.id === _this.id;
|
|
63
|
+
const nodeData = data.nodes.find((n) => {
|
|
64
|
+
return n.id === this.id;
|
|
78
65
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
const defaultColor = colorScale(Number(nodeData?.cumulative));
|
|
67
|
+
const node = d3.select(this);
|
|
68
|
+
const path = node.select('path');
|
|
82
69
|
node
|
|
83
70
|
.style('cursor', 'pointer')
|
|
84
71
|
.on('mouseenter', function () {
|
|
85
72
|
if (isShiftDown)
|
|
86
73
|
return;
|
|
87
74
|
d3.select(this).select('path').style('fill', 'white');
|
|
88
|
-
|
|
75
|
+
const hoveringNode = {
|
|
76
|
+
...nodeData,
|
|
77
|
+
meta: { ...nodeData?.meta, lineIndex: 0, locationIndex: 0 },
|
|
78
|
+
};
|
|
89
79
|
// @ts-expect-error
|
|
90
80
|
dispatch(setHoveringNode(hoveringNode));
|
|
91
81
|
})
|
|
@@ -104,10 +94,10 @@ var Callgraph = function (_a) {
|
|
|
104
94
|
}, [svgWrapper.current, svgWrapperLoaded]);
|
|
105
95
|
if (data.nodes.length < 1)
|
|
106
96
|
return _jsx(_Fragment, { children: "Profile has no samples" });
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
const resetView = () => setView(originalView);
|
|
98
|
+
const isResetViewButtonEnabled = view.scale !== originalView.scale ||
|
|
109
99
|
view.translation.x !== originalView.translation.x ||
|
|
110
100
|
view.translation.y !== originalView.translation.y;
|
|
111
|
-
return (_jsxs("div",
|
|
101
|
+
return (_jsxs("div", { className: "relative w-full", children: [_jsxs("div", { ref: containerRef, className: "w-full overflow-hidden", children: [_jsx(MapInteractionCSS, { showControls: true, minScale: 1, maxScale: 5, value: view, onChange: (value) => setView(value), children: _jsx(SVG, { ref: svgWrapper, src: svgString, width: width, height: "auto", title: "Callgraph", innerRef: svgRef }) }), svgRef.current !== null && (_jsx(GraphTooltip, { type: "callgraph", unit: sampleUnit, total: data.cumulative, totalUnfiltered: data.cumulative, contextElement: containerRef.current }))] }), _jsx("div", { className: cx(dashboardItems.length > 1 ? 'left-[25px]' : 'left-0', 'absolute top-[-46px] w-auto'), children: _jsx(Button, { variant: "neutral", onClick: resetView, className: "z-50", disabled: !isResetViewButtonEnabled, children: "Reset View" }) })] }));
|
|
112
102
|
};
|
|
113
103
|
export default Callgraph;
|
|
@@ -10,8 +10,15 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export
|
|
14
|
-
|
|
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 = {
|
|
15
22
|
total: '4358676',
|
|
16
23
|
unit: 'count',
|
|
17
24
|
nodes: [
|
|
@@ -98,8 +105,18 @@ export var jsonGraph = {
|
|
|
98
105
|
],
|
|
99
106
|
};
|
|
100
107
|
// just a string, doesn't need to be on separate lines
|
|
101
|
-
export
|
|
102
|
-
|
|
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 = {
|
|
103
120
|
name: '%27',
|
|
104
121
|
directed: true,
|
|
105
122
|
strict: false,
|
|
@@ -426,8 +443,8 @@ export var jsonGraphWithGraphvizPositions = {
|
|
|
426
443
|
},
|
|
427
444
|
],
|
|
428
445
|
};
|
|
429
|
-
export
|
|
430
|
-
id
|
|
446
|
+
export const nodeWithMetaData = (id, name) => ({
|
|
447
|
+
id,
|
|
431
448
|
cumulative: Math.floor(Math.random() * 10),
|
|
432
449
|
meta: {
|
|
433
450
|
location: {
|
|
@@ -449,7 +466,7 @@ export var nodeWithMetaData = function (id, name) { return ({
|
|
|
449
466
|
'14': 76,
|
|
450
467
|
'15': 130,
|
|
451
468
|
},
|
|
452
|
-
address:
|
|
469
|
+
address: `${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}`,
|
|
453
470
|
mappingId: {
|
|
454
471
|
'0': 72,
|
|
455
472
|
'1': 191,
|
|
@@ -519,9 +536,9 @@ export var nodeWithMetaData = function (id, name) { return ({
|
|
|
519
536
|
'15': 177,
|
|
520
537
|
},
|
|
521
538
|
startLine: '0',
|
|
522
|
-
name
|
|
539
|
+
name,
|
|
523
540
|
systemName: 'runtime.gopark',
|
|
524
|
-
filename:
|
|
541
|
+
filename: `/opt/homebrew/Cellar/go/1.18.2/libexec/src/runtime/proc.go/${name}`,
|
|
525
542
|
},
|
|
526
543
|
line: {
|
|
527
544
|
functionId: {
|
|
@@ -545,8 +562,8 @@ export var nodeWithMetaData = function (id, name) { return ({
|
|
|
545
562
|
line: '361',
|
|
546
563
|
},
|
|
547
564
|
},
|
|
548
|
-
});
|
|
549
|
-
export
|
|
565
|
+
});
|
|
566
|
+
export const jsonGraphWithMetaData = {
|
|
550
567
|
total: '4358676',
|
|
551
568
|
nodes: [
|
|
552
569
|
nodeWithMetaData('root', 'root node'),
|
package/dist/Callgraph/utils.js
CHANGED
|
@@ -10,23 +10,13 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
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
13
|
import * as d3 from 'd3';
|
|
23
14
|
import { withAlphaHex } from 'with-alpha-hex';
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
var pos = _a.pos, _b = _a.xScale, xScale = _b === void 0 ? function (n) { return n; } : _b, _c = _a.yScale, yScale = _c === void 0 ? function (n) { return n; } : _c, _d = _a.source, source = _d === void 0 ? [] : _d, _e = _a.target, target = _e === void 0 ? [] : _e, _f = _a.offset, offset = _f === void 0 ? 0 : _f, _g = _a.isSelfLoop, isSelfLoop = _g === void 0 ? false : _g;
|
|
15
|
+
export const pixelsToInches = (pixels) => pixels / 96;
|
|
16
|
+
export const getCurvePoints = ({ pos, xScale = n => n, yScale = n => n, source = [], target = [], offset = 0, isSelfLoop = false, }) => {
|
|
27
17
|
if (isSelfLoop) {
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
const [sourceX, sourceY] = source;
|
|
19
|
+
const [targetX, targetY] = target;
|
|
30
20
|
return [
|
|
31
21
|
sourceX,
|
|
32
22
|
sourceY + offset,
|
|
@@ -39,66 +29,69 @@ export var getCurvePoints = function (_a) {
|
|
|
39
29
|
];
|
|
40
30
|
}
|
|
41
31
|
// graphviz pos format is in format 'endpoint,startpoint,triple(cp1,cp2,end),...triple...'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var offsetX = (diffX * offset) / diffZ;
|
|
56
|
-
var offsetY = (diffY * offset) / diffZ;
|
|
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;
|
|
57
45
|
return [targetX - offsetX, targetY - offsetY];
|
|
58
46
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
};
|
|
65
|
-
var objectAsDotAttributes = function (obj) {
|
|
66
|
-
return Object.entries(obj)
|
|
67
|
-
.map(function (entry) { return "".concat(entry[0], "=\"").concat(entry[1], "\""); })
|
|
68
|
-
.join(' ');
|
|
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();
|
|
69
52
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
76
61
|
.scaleSequentialLog(d3.interpolateBlues)
|
|
77
62
|
.domain(cumulativesRange)
|
|
78
63
|
.range(colorRange);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
label: (_e = (_d = (_c = node.meta) === null || _c === void 0 ? void 0 : _c.function) === null || _d === void 0 ? void 0 : _d.name.substring(0, 12)) !== null && _e !== void 0 ? _e : '',
|
|
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) ?? '',
|
|
86
70
|
root: (node.id === 'root').toString(),
|
|
87
71
|
fillcolor: hexColor,
|
|
88
72
|
className: 'node',
|
|
89
73
|
id: node.id,
|
|
90
74
|
};
|
|
91
|
-
return "
|
|
75
|
+
return `"${node.id}" [${objectAsDotAttributes(dataAttributes)}]`;
|
|
92
76
|
});
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
cumulative: edge.cumulative,
|
|
77
|
+
const edgesAsStrings = edges.map((edge) => {
|
|
78
|
+
const dataAttributes = {
|
|
79
|
+
cumulative: Number(edge.cumulative),
|
|
96
80
|
color: withAlphaHex(colorRange[1], colorOpacityScale(Number(edge.cumulative))),
|
|
97
81
|
className: 'edge',
|
|
98
82
|
// boxHeight: DEFAULT_NODE_HEIGHT,
|
|
99
83
|
};
|
|
100
|
-
return "
|
|
84
|
+
return `"${edge.source}" -> "${edge.target}" [${objectAsDotAttributes(dataAttributes)}]`;
|
|
101
85
|
});
|
|
102
|
-
|
|
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
|
+
}`;
|
|
103
96
|
return graphAsDot;
|
|
104
97
|
};
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
return (_jsxs("div", __assign({ className: "group relative w-full" }, { children: [_jsx("div", __assign({ className: "w-full overflow-hidden text-ellipsis whitespace-nowrap" }, { children: displayValue !== null && displayValue !== void 0 ? displayValue : value })), _jsx("div", __assign({ className: "absolute -inset-2 hidden h-fit max-w-[500px] whitespace-normal break-all rounded bg-gray-50 p-2 shadow-[0_0_10px_2px_rgba(0,0,0,0.3)] group-hover:flex dark:bg-gray-900" }, { children: value }))] })));
|
|
2
|
+
export const ExpandOnHover = ({ value, displayValue }) => {
|
|
3
|
+
return (_jsxs("div", { className: "group relative w-full", children: [_jsx("div", { className: "w-full overflow-hidden text-ellipsis whitespace-nowrap", children: displayValue ?? value }), _jsx("div", { className: "absolute -inset-2 hidden h-fit max-w-[500px] whitespace-normal break-all rounded bg-gray-50 p-2 shadow-[0_0_10px_2px_rgba(0,0,0,0.3)] group-hover:flex dark:bg-gray-900", children: value })] }));
|
|
16
4
|
};
|
|
@@ -5,15 +5,15 @@ interface ExtendedCallgraphNodeMeta extends CallgraphNodeMeta {
|
|
|
5
5
|
locationIndex: number;
|
|
6
6
|
}
|
|
7
7
|
interface HoveringNode extends FlamegraphRootNode, FlamegraphNode, CallgraphNode {
|
|
8
|
-
diff:
|
|
8
|
+
diff: bigint;
|
|
9
9
|
meta?: FlamegraphNodeMeta | ExtendedCallgraphNodeMeta;
|
|
10
10
|
}
|
|
11
11
|
interface GraphTooltipProps {
|
|
12
12
|
x?: number;
|
|
13
13
|
y?: number;
|
|
14
14
|
unit: string;
|
|
15
|
-
total:
|
|
16
|
-
totalUnfiltered:
|
|
15
|
+
total: bigint;
|
|
16
|
+
totalUnfiltered: bigint;
|
|
17
17
|
hoveringNode?: HoveringNode;
|
|
18
18
|
contextElement: Element | null;
|
|
19
19
|
isFixed?: boolean;
|
|
@@ -27,8 +27,8 @@ interface GraphTooltipProps {
|
|
|
27
27
|
export declare const GraphTooltipContent: ({ hoveringNode, unit, total, totalUnfiltered, isFixed, strings, mappings, locations, functions, type, }: {
|
|
28
28
|
hoveringNode: HoveringNode;
|
|
29
29
|
unit: string;
|
|
30
|
-
total:
|
|
31
|
-
totalUnfiltered:
|
|
30
|
+
total: bigint;
|
|
31
|
+
totalUnfiltered: bigint;
|
|
32
32
|
isFixed: boolean;
|
|
33
33
|
strings?: string[] | undefined;
|
|
34
34
|
mappings?: Mapping[] | undefined;
|