@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,102 +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
-
14
- import {FlamegraphNode} from '@parca/client';
15
- import {
16
- Location,
17
- Mapping,
18
- Function as ParcaFunction,
19
- } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
20
- import {BINARY_FEATURE_TYPES, EVERYTHING_ELSE, type BinaryFeature} from '@parca/store';
21
- import {getLastItem} from '@parca/utilities';
22
-
23
- import {hexifyAddress} from '../../utils';
24
-
25
- export const getBinaryName = (
26
- node: FlamegraphNode,
27
- mappings: Mapping[],
28
- locations: Location[],
29
- strings: string[]
30
- ): string | undefined => {
31
- if (node.meta?.locationIndex === undefined || node.meta?.locationIndex === 0) {
32
- return undefined;
33
- }
34
- if (node.meta.locationIndex > locations.length) {
35
- return undefined;
36
- }
37
-
38
- const location = locations[node.meta.locationIndex - 1];
39
-
40
- if (location.mappingIndex === undefined || location.mappingIndex === 0) {
41
- return undefined;
42
- }
43
- const mapping = mappings[location.mappingIndex - 1];
44
- if (mapping == null || mapping.fileStringIndex == null) {
45
- return undefined;
46
- }
47
-
48
- const mappingFile = strings[mapping.fileStringIndex];
49
- return getLastItem(mappingFile);
50
- };
51
-
52
- export function nodeLabel(
53
- node: FlamegraphNode,
54
- strings: string[],
55
- mappings: Mapping[],
56
- locations: Location[],
57
- functions: ParcaFunction[],
58
- showBinaryName: boolean
59
- ): string {
60
- if (node.meta?.locationIndex === undefined) return '<unknown>';
61
- if (node.meta?.locationIndex === 0) return '<unknown>';
62
-
63
- if (node.meta.locationIndex > locations.length) {
64
- console.info('location index out of bounds', node.meta.locationIndex, locations.length);
65
- return '<unknown>';
66
- }
67
-
68
- const location = locations[node.meta.locationIndex - 1];
69
- if (location === undefined) return '<unknown>';
70
-
71
- let mappingString = '';
72
-
73
- if (showBinaryName) {
74
- const binary = getBinaryName(node, mappings, locations, strings);
75
- if (binary != null) mappingString = `[${binary}]`;
76
- }
77
-
78
- if (location.lines.length > 0) {
79
- const funcName =
80
- strings[functions[location.lines[node.meta.lineIndex].functionIndex - 1].nameStringIndex];
81
- return `${mappingString.length > 0 ? `${mappingString} ` : ''}${funcName}`;
82
- }
83
-
84
- const address = hexifyAddress(location.address);
85
- const fallback = `${mappingString}${address}`;
86
-
87
- return fallback === '' ? '<unknown>' : fallback;
88
- }
89
-
90
- export const extractFeature = (
91
- data: FlamegraphNode,
92
- mappings: Mapping[],
93
- locations: Location[],
94
- strings: string[]
95
- ): BinaryFeature => {
96
- const binaryName = getBinaryName(data, mappings, locations, strings);
97
- if (binaryName != null) {
98
- return {name: binaryName, type: BINARY_FEATURE_TYPES.Binary};
99
- }
100
-
101
- return {name: EVERYTHING_ELSE, type: BINARY_FEATURE_TYPES.Misc};
102
- };
@@ -1,130 +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
-
14
- import React, {Fragment} from 'react';
15
-
16
- import {scaleLinear} from '@parca/utilities';
17
-
18
- import {FIELD_CHILDREN, FIELD_CUMULATIVE, FIELD_DURATION, FIELD_TIMESTAMP} from '.';
19
- import {ProfileSource} from '../../ProfileSource';
20
- import {IcicleNode, IcicleNodeProps, RowHeight} from './IcicleGraphNodes';
21
- import {boundsFromProfileSource} from './utils';
22
-
23
- interface IcicleChartRootNodeSpecificProps {
24
- profileSource?: ProfileSource;
25
- }
26
-
27
- export const IcicleChartRootNode = React.memo(function IcicleChartRootNodeNonMemo({
28
- table,
29
- row,
30
- colors,
31
- colorBy,
32
- y,
33
- setCurPath,
34
- curPath,
35
- level,
36
- path,
37
- total,
38
- totalWidth,
39
- xScale,
40
- searchString,
41
- setHoveringRow,
42
- setHoveringLevel,
43
- sortBy,
44
- darkMode,
45
- compareMode,
46
- profileType,
47
- isContextMenuOpen,
48
- hoveringName,
49
- setHoveringName,
50
- hoveringRow,
51
- colorForSimilarNodes,
52
- highlightSimilarStacksPreference,
53
- profileSource,
54
- }: IcicleNodeProps & IcicleChartRootNodeSpecificProps): React.JSX.Element {
55
- // get the columns to read from
56
- const durationColumn = table.getChild(FIELD_DURATION);
57
- const timestampColumn = table.getChild(FIELD_TIMESTAMP);
58
- const cumulativeColumn = table.getChild(FIELD_CUMULATIVE);
59
- const cumulative = cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
60
- const childRows: number[] = Array.from<number>(
61
- table.getChild(FIELD_CHILDREN)?.get(row) ?? []
62
- ).sort((a, b) => a - b);
63
-
64
- const tsBounds = boundsFromProfileSource(profileSource);
65
-
66
- const nextLevel = level + 1;
67
- const nextCurPath = curPath.length === 0 ? [] : curPath.slice(1);
68
- const tsXScale = scaleLinear([tsBounds[0], tsBounds[1]], [0, totalWidth]);
69
-
70
- const width: number =
71
- nextCurPath.length > 0 || (nextCurPath.length === 0 && curPath.length === 1)
72
- ? totalWidth
73
- : xScale(BigInt(cumulative));
74
-
75
- if (width <= 1) {
76
- return <>{null}</>;
77
- }
78
-
79
- return (
80
- <>
81
- {childRows.map(row => {
82
- const duration = durationColumn?.get(row) !== null ? BigInt(durationColumn?.get(row)) : 0n;
83
- const timestamp =
84
- timestampColumn?.get(row) !== null ? BigInt(timestampColumn?.get(row)) : 0n;
85
-
86
- const x = tsXScale(timestamp);
87
- const width = tsXScale(timestamp + BigInt(Math.round(Number(duration)))) - x;
88
-
89
- const cumulative =
90
- cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
91
- const newXScale = scaleLinear([0n, BigInt(cumulative)], [0, width]);
92
-
93
- return (
94
- <Fragment key={row}>
95
- <IcicleNode
96
- table={table}
97
- row={row}
98
- colors={colors}
99
- colorBy={colorBy}
100
- x={x}
101
- y={y}
102
- totalWidth={width ?? 1}
103
- height={RowHeight}
104
- setCurPath={setCurPath}
105
- curPath={curPath}
106
- total={total}
107
- xScale={newXScale}
108
- path={path}
109
- level={nextLevel}
110
- searchString={(searchString as string) ?? ''}
111
- setHoveringRow={setHoveringRow}
112
- setHoveringLevel={setHoveringLevel}
113
- sortBy={sortBy}
114
- darkMode={darkMode}
115
- compareMode={compareMode}
116
- profileType={profileType}
117
- isContextMenuOpen={isContextMenuOpen}
118
- hoveringName={hoveringName}
119
- setHoveringName={setHoveringName}
120
- hoveringRow={hoveringRow}
121
- colorForSimilarNodes={colorForSimilarNodes}
122
- highlightSimilarStacksPreference={highlightSimilarStacksPreference}
123
- key={row}
124
- />
125
- </Fragment>
126
- );
127
- })}
128
- </>
129
- );
130
- });
@@ -1,69 +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
-
14
- import {useEffect, useState} from 'react';
15
-
16
- import graphviz from 'graphviz-wasm';
17
-
18
- import {Callgraph as CallgraphType} from '@parca/client';
19
-
20
- import {jsonToDot} from '../../Callgraph/utils';
21
-
22
- interface UseGraphvizProps {
23
- callgraphData?: CallgraphType;
24
- width?: number;
25
- colorRange: [string, string];
26
- }
27
-
28
- export const useGraphviz = ({
29
- callgraphData,
30
- width,
31
- colorRange,
32
- }: UseGraphvizProps): {
33
- graphvizLoaded: boolean;
34
- callgraphSVG: string | undefined;
35
- } => {
36
- const [graphvizLoaded, setGraphvizLoaded] = useState(false);
37
- const [callgraphSVG, setCallgraphSVG] = useState<string | undefined>(undefined);
38
-
39
- useEffect(() => {
40
- async function loadGraphviz(): Promise<void> {
41
- await graphviz.loadWASM();
42
- setGraphvizLoaded(true);
43
- }
44
- void loadGraphviz();
45
- }, []);
46
-
47
- useEffect(() => {
48
- async function loadCallgraphSVG(
49
- graph: CallgraphType,
50
- width: number,
51
- colorRange: [string, string]
52
- ): Promise<void> {
53
- await setCallgraphSVG(undefined);
54
- const dataAsDot = await jsonToDot({
55
- graph,
56
- width,
57
- colorRange,
58
- });
59
- const svgGraph = await graphviz.layout(dataAsDot, 'svg', 'dot');
60
- await setCallgraphSVG(svgGraph);
61
- }
62
-
63
- if (graphvizLoaded && callgraphData != null && width != null) {
64
- void loadCallgraphSVG(callgraphData, width, colorRange);
65
- }
66
- }, [graphvizLoaded, callgraphData, width, colorRange]);
67
-
68
- return {graphvizLoaded, callgraphSVG};
69
- };