@parca/profile 0.18.3 → 0.19.0
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 +10 -0
- package/dist/GraphTooltipArrow/useGraphTooltip/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/useGraphTooltip/index.js +6 -3
- package/dist/MetricsGraph/UtilizationMetrics/index.d.ts.map +1 -1
- package/dist/MetricsGraph/UtilizationMetrics/index.js +6 -2
- package/dist/MetricsGraph/index.d.ts.map +1 -1
- package/dist/MetricsGraph/index.js +8 -4
- package/dist/MetricsSeries/index.d.ts +2 -1
- package/dist/MetricsSeries/index.d.ts.map +1 -1
- package/dist/MetricsSeries/index.js +2 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts +2 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.js +13 -3
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.d.ts +1 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts +4 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.js +15 -6
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.js +5 -4
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.d.ts +2 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.js +3 -2
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts +3 -0
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +4 -4
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.js +1 -1
- package/dist/ProfileIcicleGraph/index.d.ts +4 -1
- package/dist/ProfileIcicleGraph/index.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/index.js +22 -6
- package/dist/ProfileView/components/DashboardItems/index.d.ts +3 -1
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
- package/dist/ProfileView/components/DashboardItems/index.js +4 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +0 -13
- package/dist/ProfileView/components/Toolbars/index.d.ts +8 -0
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +6 -2
- package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts +1 -0
- package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +1 -1
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/index.js +9 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +4 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +9 -1
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +3 -2
- package/dist/ProfileView/types/visualization.d.ts +1 -1
- package/dist/ProfileView/types/visualization.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +1 -1
- package/dist/Sandwich/components/CalleesSection.d.ts +25 -0
- package/dist/Sandwich/components/CalleesSection.d.ts.map +1 -0
- package/dist/Sandwich/components/CalleesSection.js +11 -0
- package/dist/Sandwich/components/CallersSection.d.ts +25 -0
- package/dist/Sandwich/components/CallersSection.d.ts.map +1 -0
- package/dist/Sandwich/components/CallersSection.js +11 -0
- package/dist/Sandwich/components/TableSection.d.ts +21 -0
- package/dist/Sandwich/components/TableSection.d.ts.map +1 -0
- package/dist/Sandwich/components/TableSection.js +7 -0
- package/dist/Sandwich/index.d.ts +19 -0
- package/dist/Sandwich/index.d.ts.map +1 -0
- package/dist/Sandwich/index.js +182 -0
- package/dist/Sandwich/utils/processRowData.d.ts +11 -0
- package/dist/Sandwich/utils/processRowData.d.ts.map +1 -0
- package/dist/Sandwich/utils/processRowData.js +53 -0
- package/dist/Table/ColorCell.d.ts +7 -0
- package/dist/Table/ColorCell.d.ts.map +1 -0
- package/dist/Table/ColorCell.js +2 -0
- package/dist/Table/MoreDropdown.d.ts +5 -0
- package/dist/Table/MoreDropdown.d.ts.map +1 -0
- package/dist/Table/MoreDropdown.js +39 -0
- package/dist/Table/hooks/useColorManagement.d.ts +14 -0
- package/dist/Table/hooks/useColorManagement.d.ts.map +1 -0
- package/dist/Table/hooks/useColorManagement.js +32 -0
- package/dist/Table/hooks/useTableConfiguration.d.ts +21 -0
- package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -0
- package/dist/Table/hooks/useTableConfiguration.js +204 -0
- package/dist/Table/index.d.ts +14 -4
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +34 -332
- package/dist/Table/utils/functions.d.ts +1 -0
- package/dist/Table/utils/functions.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/useQuery.d.ts +1 -0
- package/dist/useQuery.d.ts.map +1 -1
- package/dist/useQuery.js +7 -1
- package/package.json +7 -7
- package/src/GraphTooltipArrow/useGraphTooltip/index.ts +6 -3
- package/src/MetricsGraph/UtilizationMetrics/index.tsx +6 -2
- package/src/MetricsGraph/index.tsx +12 -2
- package/src/MetricsSeries/index.tsx +3 -0
- package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx +23 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenuWrapper.tsx +1 -0
- package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +34 -5
- package/src/ProfileIcicleGraph/IcicleGraphArrow/MemoizedTooltip.tsx +6 -4
- package/src/ProfileIcicleGraph/IcicleGraphArrow/TooltipContext.tsx +5 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +13 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +1 -1
- package/src/ProfileIcicleGraph/index.tsx +50 -18
- package/src/ProfileView/components/DashboardItems/index.tsx +21 -0
- package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +11 -25
- package/src/ProfileView/components/Toolbars/index.tsx +42 -1
- package/src/ProfileView/components/ViewSelector/Dropdown.tsx +2 -1
- package/src/ProfileView/components/ViewSelector/index.tsx +11 -0
- package/src/ProfileView/hooks/useVisualizationState.ts +16 -1
- package/src/ProfileView/index.tsx +7 -0
- package/src/ProfileView/types/visualization.ts +7 -1
- package/src/ProfileViewWithData.tsx +1 -1
- package/src/Sandwich/components/CalleesSection.tsx +87 -0
- package/src/Sandwich/components/CallersSection.tsx +88 -0
- package/src/Sandwich/components/TableSection.tsx +67 -0
- package/src/Sandwich/index.tsx +342 -0
- package/src/Sandwich/utils/processRowData.ts +78 -0
- package/src/Table/ColorCell.tsx +26 -0
- package/src/Table/MoreDropdown.tsx +75 -0
- package/src/Table/hooks/useColorManagement.ts +58 -0
- package/src/Table/hooks/useTableConfiguration.tsx +237 -0
- package/src/Table/index.tsx +37 -470
- package/src/Table/utils/functions.ts +1 -0
- package/src/useQuery.tsx +10 -1
|
@@ -0,0 +1,237 @@
|
|
|
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, useMemo, useState} from 'react';
|
|
15
|
+
|
|
16
|
+
import {createColumnHelper, type ColumnDef} from '@tanstack/table-core';
|
|
17
|
+
|
|
18
|
+
import {useURLState} from '@parca/components';
|
|
19
|
+
import {valueFormatter} from '@parca/utilities';
|
|
20
|
+
|
|
21
|
+
import {type Row} from '..';
|
|
22
|
+
import {ColorCell} from '../ColorCell';
|
|
23
|
+
import MoreDropdown from '../MoreDropdown';
|
|
24
|
+
import {addPlusSign, ratioString, type ColumnName} from '../utils/functions';
|
|
25
|
+
|
|
26
|
+
interface UseTableConfigurationProps {
|
|
27
|
+
unit?: string;
|
|
28
|
+
total: bigint;
|
|
29
|
+
filtered: bigint;
|
|
30
|
+
compareMode: boolean;
|
|
31
|
+
isSandwich?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface TableConfiguration {
|
|
35
|
+
columns: Array<ColumnDef<Row>>;
|
|
36
|
+
initialSorting: Array<{id: string; desc: boolean}>;
|
|
37
|
+
columnVisibility: Record<ColumnName, boolean>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function useTableConfiguration({
|
|
41
|
+
unit = '',
|
|
42
|
+
total,
|
|
43
|
+
filtered,
|
|
44
|
+
compareMode,
|
|
45
|
+
}: UseTableConfigurationProps): TableConfiguration {
|
|
46
|
+
const columnHelper = createColumnHelper<Row>();
|
|
47
|
+
const [tableColumns] = useURLState<string[]>('table_columns', {
|
|
48
|
+
alwaysReturnArray: true,
|
|
49
|
+
});
|
|
50
|
+
const [dashboardItems] = useURLState<string[]>('dashboard_items', {
|
|
51
|
+
alwaysReturnArray: true,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const [columnVisibility, setColumnVisibility] = useState(() => {
|
|
55
|
+
return {
|
|
56
|
+
color: true,
|
|
57
|
+
flat: true,
|
|
58
|
+
flatPercentage: false,
|
|
59
|
+
flatDiff: compareMode,
|
|
60
|
+
flatDiffPercentage: false,
|
|
61
|
+
cumulative: true,
|
|
62
|
+
cumulativePercentage: false,
|
|
63
|
+
cumulativeDiff: compareMode,
|
|
64
|
+
cumulativeDiffPercentage: false,
|
|
65
|
+
name: true,
|
|
66
|
+
functionSystemName: false,
|
|
67
|
+
functionFileName: false,
|
|
68
|
+
mappingFile: false,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (Array.isArray(tableColumns)) {
|
|
74
|
+
setColumnVisibility(prevState => {
|
|
75
|
+
const newState = {...prevState};
|
|
76
|
+
(Object.keys(newState) as ColumnName[]).forEach(column => {
|
|
77
|
+
newState[column] = tableColumns.includes(column);
|
|
78
|
+
});
|
|
79
|
+
return newState;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, [tableColumns]);
|
|
83
|
+
|
|
84
|
+
const columns = useMemo<Array<ColumnDef<Row>>>(() => {
|
|
85
|
+
const baseColumns: Array<ColumnDef<Row>> = [
|
|
86
|
+
columnHelper.accessor('colorProperty', {
|
|
87
|
+
id: 'color',
|
|
88
|
+
header: '',
|
|
89
|
+
cell: info => {
|
|
90
|
+
const color = info.getValue() as {color: string; mappingFile: string};
|
|
91
|
+
return <ColorCell color={color.color} mappingFile={color.mappingFile} />;
|
|
92
|
+
},
|
|
93
|
+
size: 10,
|
|
94
|
+
enableSorting: false,
|
|
95
|
+
}),
|
|
96
|
+
columnHelper.accessor('flat', {
|
|
97
|
+
id: 'flat',
|
|
98
|
+
header: 'Flat',
|
|
99
|
+
cell: info => valueFormatter(info.getValue(), unit, 2),
|
|
100
|
+
size: 80,
|
|
101
|
+
meta: {
|
|
102
|
+
align: 'right',
|
|
103
|
+
},
|
|
104
|
+
invertSorting: true,
|
|
105
|
+
}),
|
|
106
|
+
columnHelper.accessor('flat', {
|
|
107
|
+
id: 'flatPercentage',
|
|
108
|
+
header: 'Flat (%)',
|
|
109
|
+
cell: info => {
|
|
110
|
+
return ratioString(info.getValue(), total, filtered);
|
|
111
|
+
},
|
|
112
|
+
size: 120,
|
|
113
|
+
meta: {
|
|
114
|
+
align: 'right',
|
|
115
|
+
},
|
|
116
|
+
invertSorting: true,
|
|
117
|
+
}),
|
|
118
|
+
columnHelper.accessor('flatDiff', {
|
|
119
|
+
id: 'flatDiff',
|
|
120
|
+
header: 'Flat Diff',
|
|
121
|
+
cell: info => addPlusSign(valueFormatter(info.getValue(), unit, 2)),
|
|
122
|
+
size: 120,
|
|
123
|
+
meta: {
|
|
124
|
+
align: 'right',
|
|
125
|
+
},
|
|
126
|
+
invertSorting: true,
|
|
127
|
+
}),
|
|
128
|
+
columnHelper.accessor('flatDiff', {
|
|
129
|
+
id: 'flatDiffPercentage',
|
|
130
|
+
header: 'Flat Diff (%)',
|
|
131
|
+
cell: info => {
|
|
132
|
+
return ratioString(info.getValue(), total, filtered);
|
|
133
|
+
},
|
|
134
|
+
size: 120,
|
|
135
|
+
meta: {
|
|
136
|
+
align: 'right',
|
|
137
|
+
},
|
|
138
|
+
invertSorting: true,
|
|
139
|
+
}),
|
|
140
|
+
columnHelper.accessor('cumulative', {
|
|
141
|
+
id: 'cumulative',
|
|
142
|
+
header: 'Cumulative',
|
|
143
|
+
cell: info => valueFormatter(info.getValue(), unit, 2),
|
|
144
|
+
size: 150,
|
|
145
|
+
meta: {
|
|
146
|
+
align: 'right',
|
|
147
|
+
},
|
|
148
|
+
invertSorting: true,
|
|
149
|
+
}),
|
|
150
|
+
columnHelper.accessor('cumulative', {
|
|
151
|
+
id: 'cumulativePercentage',
|
|
152
|
+
header: 'Cumulative (%)',
|
|
153
|
+
cell: info => {
|
|
154
|
+
return ratioString(info.getValue(), total, filtered);
|
|
155
|
+
},
|
|
156
|
+
size: 150,
|
|
157
|
+
meta: {
|
|
158
|
+
align: 'right',
|
|
159
|
+
},
|
|
160
|
+
invertSorting: true,
|
|
161
|
+
}),
|
|
162
|
+
columnHelper.accessor('cumulativeDiff', {
|
|
163
|
+
id: 'cumulativeDiff',
|
|
164
|
+
header: 'Cumulative Diff',
|
|
165
|
+
cell: info => addPlusSign(valueFormatter(info.getValue(), unit, 2)),
|
|
166
|
+
size: 170,
|
|
167
|
+
meta: {
|
|
168
|
+
align: 'right',
|
|
169
|
+
},
|
|
170
|
+
invertSorting: true,
|
|
171
|
+
}),
|
|
172
|
+
columnHelper.accessor('cumulativeDiff', {
|
|
173
|
+
id: 'cumulativeDiffPercentage',
|
|
174
|
+
header: 'Cumulative Diff (%)',
|
|
175
|
+
cell: info => {
|
|
176
|
+
return ratioString(info.getValue(), total, filtered);
|
|
177
|
+
},
|
|
178
|
+
size: 170,
|
|
179
|
+
meta: {
|
|
180
|
+
align: 'right',
|
|
181
|
+
},
|
|
182
|
+
invertSorting: true,
|
|
183
|
+
}),
|
|
184
|
+
columnHelper.accessor('name', {
|
|
185
|
+
id: 'name',
|
|
186
|
+
header: 'Name',
|
|
187
|
+
cell: info => info.getValue(),
|
|
188
|
+
}),
|
|
189
|
+
columnHelper.accessor('functionSystemName', {
|
|
190
|
+
id: 'functionSystemName',
|
|
191
|
+
header: 'Function System Name',
|
|
192
|
+
cell: info => info.getValue(),
|
|
193
|
+
}),
|
|
194
|
+
columnHelper.accessor('functionFileName', {
|
|
195
|
+
id: 'functionFileName',
|
|
196
|
+
header: 'Function File Name',
|
|
197
|
+
cell: info => info.getValue(),
|
|
198
|
+
}),
|
|
199
|
+
columnHelper.accessor('mappingFile', {
|
|
200
|
+
id: 'mappingFile',
|
|
201
|
+
header: 'Mapping File',
|
|
202
|
+
cell: info => info.getValue(),
|
|
203
|
+
}),
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
if (dashboardItems.length === 1 && dashboardItems[0] === 'table') {
|
|
207
|
+
baseColumns.unshift(
|
|
208
|
+
columnHelper.accessor('moreActions', {
|
|
209
|
+
id: 'moreActions',
|
|
210
|
+
header: '',
|
|
211
|
+
cell: info => {
|
|
212
|
+
return <MoreDropdown functionName={info.row.original.name} />;
|
|
213
|
+
},
|
|
214
|
+
size: 10,
|
|
215
|
+
enableSorting: false,
|
|
216
|
+
})
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return baseColumns;
|
|
221
|
+
}, [unit, total, filtered, columnHelper, dashboardItems]);
|
|
222
|
+
|
|
223
|
+
const initialSorting = useMemo(() => {
|
|
224
|
+
return [
|
|
225
|
+
{
|
|
226
|
+
id: compareMode ? 'flatDiff' : 'flat',
|
|
227
|
+
desc: false,
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
}, [compareMode]);
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
columns,
|
|
234
|
+
initialSorting,
|
|
235
|
+
columnVisibility,
|
|
236
|
+
};
|
|
237
|
+
}
|