@parca/profile 0.19.140 → 0.19.142
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 +5 -1
- package/dist/GraphTooltipArrow/Content.js +224 -30
- package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
- package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
- package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/index.js +86 -56
- package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
- package/dist/MatchersInput/SuggestionItem.js +91 -12
- package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
- package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
- package/dist/MatchersInput/SuggestionsList.js +371 -157
- package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
- package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
- package/dist/MatchersInput/index.js +308 -115
- package/dist/MetricsCircle/index.js +39 -3
- package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
- package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
- package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
- package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
- package/dist/MetricsGraph/index.js +552 -203
- package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
- package/dist/MetricsGraph/utils/colorMapping.js +24 -17
- package/dist/MetricsSeries/index.js +70 -7
- package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
- package/dist/PreSelectedMatchers/index.js +249 -102
- package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
- package/dist/ProfileExplorer/index.js +183 -32
- package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
- package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
- package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
- package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
- package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
- package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
- package/dist/ProfileFlameChart/index.d.ts.map +1 -1
- package/dist/ProfileFlameChart/index.js +267 -129
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
- package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
- package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
- package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
- package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
- package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
- package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
- package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
- package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
- package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/index.js +324 -150
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
- package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
- package/dist/ProfileMetricsGraph/index.js +519 -258
- package/dist/ProfileSelector/CompareButton.js +132 -12
- package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
- package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +727 -141
- package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
- package/dist/ProfileSource.js +230 -163
- package/dist/ProfileTypeSelector/index.js +214 -125
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
- package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
- package/dist/ProfileView/components/ColorStackLegend.js +185 -55
- package/dist/ProfileView/components/DashboardItems/index.js +87 -28
- package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
- package/dist/ProfileView/components/DiffLegend.js +172 -29
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
- package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
- package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
- package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
- package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
- package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
- package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
- package/dist/ProfileView/components/ShareButton/index.js +352 -62
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
- package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
- package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +441 -21
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/index.js +212 -86
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
- package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
- package/dist/ProfileView/components/VisualizationPanel.js +185 -8
- package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
- package/dist/ProfileView/context/DashboardContext.js +85 -29
- package/dist/ProfileView/context/ProfileViewContext.js +56 -15
- package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
- package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
- package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
- package/dist/ProfileView/index.js +383 -45
- package/dist/ProfileView/types/visualization.js +1 -13
- package/dist/ProfileView/utils/colorUtils.js +8 -7
- package/dist/ProfileViewWithData.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +332 -228
- package/dist/QueryControls/index.js +418 -47
- package/dist/Sandwich/components/CalleesSection.js +54 -4
- package/dist/Sandwich/components/CallersSection.js +97 -27
- package/dist/Sandwich/components/TableSection.js +77 -4
- package/dist/Sandwich/index.d.ts.map +1 -1
- package/dist/Sandwich/index.js +126 -14
- package/dist/Sandwich/utils/processRowData.js +48 -39
- package/dist/SelectWithRefresh/index.js +102 -28
- package/dist/SimpleMatchers/Select.js +520 -187
- package/dist/SimpleMatchers/index.js +590 -288
- package/dist/SourceView/Highlighter.js +230 -70
- package/dist/SourceView/LineNo.js +72 -17
- package/dist/SourceView/index.d.ts.map +1 -1
- package/dist/SourceView/index.js +178 -104
- package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
- package/dist/SourceView/lang-detector/index.js +28 -14
- package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
- package/dist/SourceView/useSelectedLineRange.js +99 -23
- package/dist/Table/ColorCell.js +42 -1
- package/dist/Table/ColumnsVisibility.js +114 -6
- package/dist/Table/MoreDropdown.d.ts.map +1 -1
- package/dist/Table/MoreDropdown.js +122 -25
- package/dist/Table/TableContextMenu.d.ts.map +1 -1
- package/dist/Table/TableContextMenu.js +151 -137
- package/dist/Table/TableContextMenuWrapper.js +59 -14
- package/dist/Table/hooks/useColorManagement.js +58 -16
- package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
- package/dist/Table/hooks/useTableConfiguration.js +333 -169
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +222 -128
- package/dist/Table/utils/functions.js +169 -144
- package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
- package/dist/TimelineGuide/index.js +209 -16
- package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
- package/dist/TopTable/index.d.ts.map +1 -1
- package/dist/TopTable/index.js +342 -123
- package/dist/contexts/LabelsQueryProvider.js +94 -32
- package/dist/contexts/UnifiedLabelsContext.js +114 -49
- package/dist/contexts/utils.js +37 -15
- package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
- package/dist/hooks/useCompareModeMeta.js +158 -64
- package/dist/hooks/useLabels.js +295 -52
- package/dist/hooks/useQueryState.d.ts +3 -3
- package/dist/hooks/useQueryState.d.ts.map +1 -1
- package/dist/hooks/useQueryState.js +373 -332
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -8
- package/dist/testdata/fg-diff.json +3750 -0
- package/dist/testdata/fg-simple.json +1879 -0
- package/dist/testdata/link_data.json +56 -0
- package/dist/testdata/tabular.json +30 -0
- package/dist/testdata/test_flamegraph.json +26846 -0
- package/dist/testdata/test_graph.json +53 -0
- package/dist/useDelayedLoader.js +32 -18
- package/dist/useGrpcQuery/index.js +71 -11
- package/dist/useHasProfileData.js +90 -12
- package/dist/useQuery.js +205 -64
- package/dist/useSumBy.d.ts +1 -1
- package/dist/useSumBy.d.ts.map +1 -1
- package/dist/useSumBy.js +294 -138
- package/dist/utils.js +62 -30
- package/package.json +9 -10
- package/src/GraphTooltipArrow/index.tsx +3 -0
- package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
- package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
- package/src/MatchersInput/SuggestionsList.tsx +11 -10
- package/src/MatchersInput/index.tsx +1 -1
- package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
- package/src/PreSelectedMatchers/index.tsx +3 -0
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
- package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
- package/src/ProfileFlameChart/index.tsx +28 -21
- package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
- package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
- package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
- package/src/ProfileFlameGraph/index.tsx +9 -6
- package/src/ProfileMetricsGraph/index.tsx +8 -6
- package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
- package/src/ProfileSelector/index.tsx +61 -39
- package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
- package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
- package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
- package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
- package/src/ProfileView/components/Toolbars/index.tsx +3 -3
- package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
- package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
- package/src/ProfileView/context/DashboardContext.tsx +6 -6
- package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
- package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
- package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
- package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
- package/src/ProfileViewWithData.tsx +35 -29
- package/src/Sandwich/index.tsx +3 -4
- package/src/SourceView/index.tsx +2 -4
- package/src/SourceView/useSelectedLineRange.ts +19 -34
- package/src/Table/MoreDropdown.tsx +11 -9
- package/src/Table/TableContextMenu.tsx +13 -10
- package/src/Table/hooks/useTableConfiguration.tsx +11 -16
- package/src/Table/index.tsx +21 -12
- package/src/TopTable/index.tsx +4 -3
- package/src/hooks/useCompareModeMeta.ts +91 -61
- package/src/hooks/useQueryState.test.tsx +345 -275
- package/src/hooks/useQueryState.ts +118 -136
- package/src/index.tsx +15 -16
- package/src/useDelayedLoader.ts +10 -10
- package/src/useSumBy.ts +15 -21
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
- package/dist/hooks/urlParsers.d.ts +0 -18
- package/dist/hooks/urlParsers.d.ts.map +0 -1
- package/dist/hooks/urlParsers.js +0 -32
- package/dist/hooks/useColorBy.d.ts +0 -5
- package/dist/hooks/useColorBy.d.ts.map +0 -1
- package/dist/hooks/useColorBy.js +0 -26
- package/dist/hooks/useDashboardItems.d.ts +0 -5
- package/dist/hooks/useDashboardItems.d.ts.map +0 -1
- package/dist/hooks/useDashboardItems.js +0 -27
- package/dist/hooks/useQueryState.test.js +0 -868
- package/src/hooks/urlParsers.ts +0 -38
- package/src/hooks/useColorBy.ts +0 -42
- package/src/hooks/useDashboardItems.ts +0 -46
package/src/SourceView/index.tsx
CHANGED
|
@@ -15,14 +15,12 @@ import React, {useCallback, useEffect, useMemo} from 'react';
|
|
|
15
15
|
|
|
16
16
|
import {tableFromIPC} from '@uwdata/flechette';
|
|
17
17
|
import {AnimatePresence, motion} from 'framer-motion';
|
|
18
|
-
import {useQueryState} from 'nuqs';
|
|
19
18
|
import {Item, Menu, useContextMenu} from 'react-contexify';
|
|
20
19
|
|
|
21
20
|
import {Source} from '@parca/client';
|
|
22
|
-
import {SourceSkeleton, useParcaContext, type ProfileData} from '@parca/components';
|
|
21
|
+
import {SourceSkeleton, useParcaContext, useURLState, type ProfileData} from '@parca/components';
|
|
23
22
|
|
|
24
23
|
import {ExpandOnHover} from '../GraphTooltipArrow/ExpandOnHoverValue';
|
|
25
|
-
import {stringParam} from '../hooks/urlParsers';
|
|
26
24
|
import {alignedUint8Array, truncateStringReverse} from '../utils';
|
|
27
25
|
import {Highlighter, profileAwareRenderer, type LineDataLookup} from './Highlighter';
|
|
28
26
|
import useLineRange from './useSelectedLineRange';
|
|
@@ -44,7 +42,7 @@ export const SourceView = React.memo(function SourceView({
|
|
|
44
42
|
filtered,
|
|
45
43
|
setActionButtons,
|
|
46
44
|
}: SourceViewProps): JSX.Element {
|
|
47
|
-
const [sourceFileName] =
|
|
45
|
+
const [sourceFileName] = useURLState<string | undefined>('source_filename');
|
|
48
46
|
const {isDarkMode, sourceViewContextMenuItems = []} = useParcaContext();
|
|
49
47
|
|
|
50
48
|
const sourceCode = useMemo(() => {
|
|
@@ -11,25 +11,9 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {useMemo} from 'react';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
interface SelectedLineRange {
|
|
19
|
-
start: number;
|
|
20
|
-
end: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const lineRangeParser = createParser<SelectedLineRange>({
|
|
24
|
-
parse: (value: string) => {
|
|
25
|
-
const [start, end] = value.split('-');
|
|
26
|
-
const startNum = parseInt(start, 10);
|
|
27
|
-
if (isNaN(startNum)) return null;
|
|
28
|
-
const endNum = end !== undefined ? parseInt(end, 10) : startNum;
|
|
29
|
-
return {start: startNum, end: isNaN(endNum) ? startNum : endNum};
|
|
30
|
-
},
|
|
31
|
-
serialize: (value: SelectedLineRange) => `${value.start}-${value.end}`,
|
|
32
|
-
}).withOptions({history: 'replace'});
|
|
16
|
+
import {useURLState} from '@parca/components';
|
|
33
17
|
|
|
34
18
|
interface LineRange {
|
|
35
19
|
startLine: number;
|
|
@@ -38,23 +22,24 @@ interface LineRange {
|
|
|
38
22
|
}
|
|
39
23
|
|
|
40
24
|
const useLineRange = (): LineRange => {
|
|
41
|
-
const [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setLineRange,
|
|
25
|
+
const [sourceLine, setSourceLine] = useURLState<string | undefined>('source_line');
|
|
26
|
+
const [startLine, endLine] = useMemo(() => {
|
|
27
|
+
if (sourceLine == null) {
|
|
28
|
+
return [-1, -1];
|
|
29
|
+
}
|
|
30
|
+
const [start, end] = sourceLine.split('-');
|
|
31
|
+
|
|
32
|
+
if (end === undefined) {
|
|
33
|
+
return [parseInt(start, 10), parseInt(start, 10)];
|
|
34
|
+
}
|
|
35
|
+
return [parseInt(start, 10), parseInt(end, 10)];
|
|
36
|
+
}, [sourceLine]);
|
|
37
|
+
|
|
38
|
+
const setLineRange = (start: number, end: number): void => {
|
|
39
|
+
setSourceLine(`${start}-${end}`);
|
|
57
40
|
};
|
|
41
|
+
|
|
42
|
+
return {startLine, endLine, setLineRange};
|
|
58
43
|
};
|
|
59
44
|
|
|
60
45
|
export default useLineRange;
|
|
@@ -13,21 +13,23 @@
|
|
|
13
13
|
|
|
14
14
|
import {Menu} from '@headlessui/react';
|
|
15
15
|
import {Icon} from '@iconify/react';
|
|
16
|
-
import {useQueryState} from 'nuqs';
|
|
17
16
|
|
|
18
|
-
import {useParcaContext} from '@parca/components';
|
|
19
|
-
|
|
20
|
-
import {stringParam} from '../hooks/urlParsers';
|
|
21
|
-
import {useDashboardItems} from '../hooks/useDashboardItems';
|
|
17
|
+
import {useParcaContext, useURLState, useURLStateBatch} from '@parca/components';
|
|
22
18
|
|
|
23
19
|
const MoreDropdown = ({functionName}: {functionName: string}): React.JSX.Element | null => {
|
|
24
|
-
const [_, setSandwichFunctionName] =
|
|
25
|
-
const
|
|
20
|
+
const [_, setSandwichFunctionName] = useURLState<string | undefined>('sandwich_function_name');
|
|
21
|
+
const [dashboardItems, setDashboardItems] = useURLState<string[]>('dashboard_items', {
|
|
22
|
+
alwaysReturnArray: true,
|
|
23
|
+
});
|
|
26
24
|
const {enableSandwichView} = useParcaContext();
|
|
25
|
+
const batchUpdates = useURLStateBatch();
|
|
27
26
|
|
|
28
27
|
const onSandwichViewSelect = (): void => {
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// Batch updates to combine setSandwichFunctionName + setDashboardItems into single URL navigation
|
|
29
|
+
batchUpdates(() => {
|
|
30
|
+
setSandwichFunctionName(functionName.trim());
|
|
31
|
+
setDashboardItems([...dashboardItems, 'sandwich']);
|
|
32
|
+
});
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
const menuItems: Array<{label: string; action: () => void}> = [];
|
|
@@ -13,18 +13,15 @@
|
|
|
13
13
|
|
|
14
14
|
import {Icon} from '@iconify/react';
|
|
15
15
|
import cx from 'classnames';
|
|
16
|
-
import {useQueryState} from 'nuqs';
|
|
17
16
|
import {Item, Menu, Submenu} from 'react-contexify';
|
|
18
17
|
|
|
19
18
|
import 'react-contexify/dist/ReactContexify.css';
|
|
20
19
|
|
|
21
|
-
import {useParcaContext} from '@parca/components';
|
|
20
|
+
import {useParcaContext, useURLState, useURLStateBatch} from '@parca/components';
|
|
22
21
|
import {valueFormatter} from '@parca/utilities';
|
|
23
22
|
|
|
24
23
|
import {type Row} from '.';
|
|
25
24
|
import {getTextForCumulative} from '../ProfileFlameGraph/FlameGraphArrow/utils';
|
|
26
|
-
import {stringParam} from '../hooks/urlParsers';
|
|
27
|
-
import {useDashboardItems} from '../hooks/useDashboardItems';
|
|
28
25
|
import {truncateString} from '../utils';
|
|
29
26
|
import {type ColumnName} from './utils/functions';
|
|
30
27
|
|
|
@@ -45,16 +42,22 @@ const TableContextMenu = ({
|
|
|
45
42
|
totalUnfiltered,
|
|
46
43
|
columnVisibility,
|
|
47
44
|
}: TableContextMenuProps): React.JSX.Element => {
|
|
48
|
-
const [_, setSandwichFunctionName] =
|
|
49
|
-
const
|
|
45
|
+
const [_, setSandwichFunctionName] = useURLState<string | undefined>('sandwich_function_name');
|
|
46
|
+
const [dashboardItems, setDashboardItems] = useURLState<string[]>('dashboard_items', {
|
|
47
|
+
alwaysReturnArray: true,
|
|
48
|
+
});
|
|
50
49
|
const {enableSandwichView, isDarkMode} = useParcaContext();
|
|
50
|
+
const batchUpdates = useURLStateBatch();
|
|
51
51
|
|
|
52
52
|
const onSandwichViewSelect = (): void => {
|
|
53
53
|
if (row?.name != null && row.name.length > 0) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
// Batch updates to combine setSandwichFunctionName + setDashboardItems into single URL navigation
|
|
55
|
+
batchUpdates(() => {
|
|
56
|
+
setSandwichFunctionName(row.name.trim());
|
|
57
|
+
if (!dashboardItems.includes('sandwich')) {
|
|
58
|
+
setDashboardItems([...dashboardItems, 'sandwich']);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
|
|
@@ -11,15 +11,14 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {useMemo} from 'react';
|
|
15
15
|
|
|
16
16
|
import {createColumnHelper, type ColumnDef} from '@tanstack/table-core';
|
|
17
|
-
import {useQueryState} from 'nuqs';
|
|
18
17
|
|
|
18
|
+
import {useURLState} from '@parca/components';
|
|
19
19
|
import {valueFormatter} from '@parca/utilities';
|
|
20
20
|
|
|
21
21
|
import {type Row} from '..';
|
|
22
|
-
import {tableColumnsParser} from '../../hooks/urlParsers';
|
|
23
22
|
import {ColorCell} from '../ColorCell';
|
|
24
23
|
import {addPlusSign, ratioString, type ColumnName} from '../utils/functions';
|
|
25
24
|
|
|
@@ -44,10 +43,12 @@ export function useTableConfiguration({
|
|
|
44
43
|
compareMode,
|
|
45
44
|
}: UseTableConfigurationProps): TableConfiguration {
|
|
46
45
|
const columnHelper = createColumnHelper<Row>();
|
|
47
|
-
const [tableColumns] =
|
|
46
|
+
const [tableColumns] = useURLState<string[]>('table_columns', {
|
|
47
|
+
alwaysReturnArray: true,
|
|
48
|
+
});
|
|
48
49
|
|
|
49
|
-
const
|
|
50
|
-
|
|
50
|
+
const columnVisibility = useMemo(() => {
|
|
51
|
+
const defaults: Record<string, boolean> = {
|
|
51
52
|
color: true,
|
|
52
53
|
flat: true,
|
|
53
54
|
flatPercentage: false,
|
|
@@ -62,19 +63,13 @@ export function useTableConfiguration({
|
|
|
62
63
|
functionFileName: false,
|
|
63
64
|
mappingFile: false,
|
|
64
65
|
};
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
66
|
if (Array.isArray(tableColumns)) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
(Object.keys(newState) as ColumnName[]).forEach(column => {
|
|
72
|
-
newState[column] = tableColumns.includes(column);
|
|
73
|
-
});
|
|
74
|
-
return newState;
|
|
67
|
+
(Object.keys(defaults) as ColumnName[]).forEach(column => {
|
|
68
|
+
defaults[column] = tableColumns.includes(column);
|
|
75
69
|
});
|
|
76
70
|
}
|
|
77
|
-
|
|
71
|
+
return defaults;
|
|
72
|
+
}, [tableColumns, compareMode]);
|
|
78
73
|
|
|
79
74
|
const columns = useMemo<Array<ColumnDef<Row>>>(() => {
|
|
80
75
|
const baseColumns: Array<ColumnDef<Row>> = [
|
package/src/Table/index.tsx
CHANGED
|
@@ -16,10 +16,14 @@ import React, {useCallback, useEffect, useMemo, useRef} from 'react';
|
|
|
16
16
|
import {RpcError} from '@protobuf-ts/runtime-rpc';
|
|
17
17
|
import {tableFromIPC} from '@uwdata/flechette';
|
|
18
18
|
import {AnimatePresence, motion} from 'framer-motion';
|
|
19
|
-
import {useQueryState} from 'nuqs';
|
|
20
19
|
import {useContextMenu} from 'react-contexify';
|
|
21
20
|
|
|
22
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
Table as TableComponent,
|
|
23
|
+
TableSkeleton,
|
|
24
|
+
useParcaContext,
|
|
25
|
+
useURLState,
|
|
26
|
+
} from '@parca/components';
|
|
23
27
|
import {useCurrentColorProfile} from '@parca/hooks';
|
|
24
28
|
import {ProfileType} from '@parca/parser';
|
|
25
29
|
|
|
@@ -27,9 +31,6 @@ import useMappingList, {
|
|
|
27
31
|
useFilenamesList,
|
|
28
32
|
} from '../ProfileFlameGraph/FlameGraphArrow/useMappingList';
|
|
29
33
|
import {useProfileViewContext} from '../ProfileView/context/ProfileViewContext';
|
|
30
|
-
import {stringParam} from '../hooks/urlParsers';
|
|
31
|
-
import {useColorBy} from '../hooks/useColorBy';
|
|
32
|
-
import {useDashboardItems} from '../hooks/useDashboardItems';
|
|
33
34
|
import {alignedUint8Array} from '../utils';
|
|
34
35
|
import TableContextMenuWrapper, {TableContextMenuWrapperRef} from './TableContextMenuWrapper';
|
|
35
36
|
import {useColorManagement} from './hooks/useColorManagement';
|
|
@@ -75,9 +76,11 @@ export const Table = React.memo(function Table({
|
|
|
75
76
|
error,
|
|
76
77
|
}: TableProps): React.JSX.Element {
|
|
77
78
|
const currentColorProfile = useCurrentColorProfile();
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const [dashboardItems] = useURLState<string[]>('dashboard_items', {
|
|
80
|
+
alwaysReturnArray: true,
|
|
81
|
+
});
|
|
82
|
+
const [_, setSandwichFunctionName] = useURLState<string | undefined>('sandwich_function_name');
|
|
83
|
+
const [colorBy, setColorBy] = useURLState('color_by');
|
|
81
84
|
const {isDarkMode} = useParcaContext();
|
|
82
85
|
const {compareMode} = useProfileViewContext();
|
|
83
86
|
|
|
@@ -105,7 +108,7 @@ export const Table = React.memo(function Table({
|
|
|
105
108
|
// If there is only one mapping file, we want to color by filename by default.
|
|
106
109
|
useEffect(() => {
|
|
107
110
|
if (mappingsListCount === 1 && colorBy !== 'filename') {
|
|
108
|
-
|
|
111
|
+
setColorBy('filename');
|
|
109
112
|
}
|
|
110
113
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
114
|
}, [mappingsListCount]);
|
|
@@ -115,7 +118,7 @@ export const Table = React.memo(function Table({
|
|
|
115
118
|
currentColorProfile,
|
|
116
119
|
mappingsList,
|
|
117
120
|
filenamesList,
|
|
118
|
-
colorBy,
|
|
121
|
+
colorBy: colorBy as string,
|
|
119
122
|
});
|
|
120
123
|
|
|
121
124
|
unit = useMemo(() => unit ?? profileType?.sampleUnit ?? '', [unit, profileType?.sampleUnit]);
|
|
@@ -132,7 +135,7 @@ export const Table = React.memo(function Table({
|
|
|
132
135
|
const selectSpan = useCallback(
|
|
133
136
|
(span: string): void => {
|
|
134
137
|
if (!dashboardItems.includes('flamegraph')) {
|
|
135
|
-
|
|
138
|
+
setSandwichFunctionName(span.trim());
|
|
136
139
|
}
|
|
137
140
|
},
|
|
138
141
|
[setSandwichFunctionName, dashboardItems]
|
|
@@ -188,7 +191,13 @@ export const Table = React.memo(function Table({
|
|
|
188
191
|
return {
|
|
189
192
|
id: i,
|
|
190
193
|
colorProperty: {
|
|
191
|
-
color: getRowColor(
|
|
194
|
+
color: getRowColor(
|
|
195
|
+
colorByColors,
|
|
196
|
+
mappingFileColumn,
|
|
197
|
+
i,
|
|
198
|
+
functionFileNameColumn,
|
|
199
|
+
colorBy as string
|
|
200
|
+
),
|
|
192
201
|
mappingFile,
|
|
193
202
|
},
|
|
194
203
|
name: RowName(mappingFileColumn, locationAddressColumn, functionNameColumn, i),
|
package/src/TopTable/index.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import React, {useCallback, useEffect, useMemo} from 'react';
|
|
|
16
16
|
import {createColumnHelper, type ColumnDef} from '@tanstack/react-table';
|
|
17
17
|
|
|
18
18
|
import {Top, TopNode, TopNodeMeta} from '@parca/client';
|
|
19
|
-
import {Button, Table} from '@parca/components';
|
|
19
|
+
import {Button, Table, useURLState} from '@parca/components';
|
|
20
20
|
import {
|
|
21
21
|
getLastItem,
|
|
22
22
|
isSearchMatch,
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
} from '@parca/utilities';
|
|
27
27
|
|
|
28
28
|
import {useProfileViewContext} from '../ProfileView/context/ProfileViewContext';
|
|
29
|
-
import {useDashboardItems} from '../hooks/useDashboardItems';
|
|
30
29
|
import {hexifyAddress} from '../utils';
|
|
31
30
|
|
|
32
31
|
interface TopTableProps {
|
|
@@ -73,7 +72,9 @@ export const TopTable = React.memo(function TopTable({
|
|
|
73
72
|
setActionButtons,
|
|
74
73
|
}: TopTableProps): JSX.Element {
|
|
75
74
|
const router = parseParams(window?.location.search);
|
|
76
|
-
const
|
|
75
|
+
const [dashboardItems] = useURLState<string[]>('dashboard_items', {
|
|
76
|
+
alwaysReturnArray: true,
|
|
77
|
+
});
|
|
77
78
|
|
|
78
79
|
const {compareMode} = useProfileViewContext();
|
|
79
80
|
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import {useCallback} from 'react';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import {boolParam, stringParam} from './urlParsers';
|
|
16
|
+
import {useURLState, useURLStateBatch} from '@parca/components';
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* Hook to manage compare mode state and operations
|
|
@@ -26,72 +24,104 @@ export const useCompareModeMeta = (): {
|
|
|
26
24
|
isCompareAbsolute: boolean;
|
|
27
25
|
closeCompareMode: (card: 'A' | 'B') => void;
|
|
28
26
|
} => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
27
|
+
const batchUpdates = useURLStateBatch();
|
|
28
|
+
|
|
29
|
+
// Side A URL state (only setters needed)
|
|
30
|
+
const [, setExpressionA] = useURLState<string>('expression_a');
|
|
31
|
+
const [, setFromA] = useURLState<string>('from_a');
|
|
32
|
+
const [, setToA] = useURLState<string>('to_a');
|
|
33
|
+
const [, setTimeSelectionA] = useURLState<string>('time_selection_a');
|
|
34
|
+
const [, setSumByA] = useURLState<string>('sum_by_a');
|
|
35
|
+
const [, setMergeFromA] = useURLState<string>('merge_from_a');
|
|
36
|
+
const [, setMergeToA] = useURLState<string>('merge_to_a');
|
|
37
|
+
const [, setSelectionA] = useURLState<string>('selection_a');
|
|
38
|
+
|
|
39
|
+
// Side B URL state
|
|
40
|
+
const [expressionB, setExpressionB] = useURLState<string>('expression_b');
|
|
41
|
+
const [fromB, setFromB] = useURLState<string>('from_b');
|
|
42
|
+
const [toB, setToB] = useURLState<string>('to_b');
|
|
43
|
+
const [timeSelectionB, setTimeSelectionB] = useURLState<string>('time_selection_b');
|
|
44
|
+
const [sumByB, setSumByB] = useURLState<string>('sum_by_b');
|
|
45
|
+
const [mergeFromB, setMergeFromB] = useURLState<string>('merge_from_b');
|
|
46
|
+
const [mergeToB, setMergeToB] = useURLState<string>('merge_to_b');
|
|
47
|
+
const [selectionB, setSelectionB] = useURLState<string>('selection_b');
|
|
48
|
+
|
|
49
|
+
// Compare mode flags (expose values for routing decisions)
|
|
50
|
+
const [compareA, setCompareA] = useURLState<string>('compare_a');
|
|
51
|
+
const [compareB, setCompareB] = useURLState<string>('compare_b');
|
|
52
|
+
const [compareAbsolute, setCompareAbsolute] = useURLState<string>('compare_absolute');
|
|
56
53
|
|
|
57
54
|
const closeCompareMode = useCallback(
|
|
58
55
|
(side: 'A' | 'B') => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
side === 'A'
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
: {};
|
|
56
|
+
batchUpdates(() => {
|
|
57
|
+
// If closing side A, swap A and B params first (keep B's data as the single view)
|
|
58
|
+
if (side === 'A') {
|
|
59
|
+
// Copy B to A
|
|
60
|
+
setExpressionA(expressionB);
|
|
61
|
+
setFromA(fromB);
|
|
62
|
+
setToA(toB);
|
|
63
|
+
setTimeSelectionA(timeSelectionB);
|
|
64
|
+
setSumByA(sumByB);
|
|
65
|
+
setMergeFromA(mergeFromB);
|
|
66
|
+
setMergeToA(mergeToB);
|
|
67
|
+
setSelectionA(selectionB);
|
|
68
|
+
}
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
// Clear all B params
|
|
71
|
+
setExpressionB(undefined);
|
|
72
|
+
setFromB(undefined);
|
|
73
|
+
setToB(undefined);
|
|
74
|
+
setTimeSelectionB(undefined);
|
|
75
|
+
setSumByB(undefined);
|
|
76
|
+
setMergeFromB(undefined);
|
|
77
|
+
setMergeToB(undefined);
|
|
78
|
+
setSelectionB(undefined);
|
|
79
|
+
|
|
80
|
+
// Clear compare mode flags
|
|
81
|
+
setCompareA(undefined);
|
|
82
|
+
setCompareB(undefined);
|
|
83
|
+
setCompareAbsolute(undefined);
|
|
88
84
|
});
|
|
89
85
|
},
|
|
90
|
-
[
|
|
86
|
+
[
|
|
87
|
+
batchUpdates,
|
|
88
|
+
// Side A setters
|
|
89
|
+
setExpressionA,
|
|
90
|
+
setFromA,
|
|
91
|
+
setToA,
|
|
92
|
+
setTimeSelectionA,
|
|
93
|
+
setSumByA,
|
|
94
|
+
setMergeFromA,
|
|
95
|
+
setMergeToA,
|
|
96
|
+
setSelectionA,
|
|
97
|
+
// Side B values (for swapping)
|
|
98
|
+
expressionB,
|
|
99
|
+
fromB,
|
|
100
|
+
toB,
|
|
101
|
+
timeSelectionB,
|
|
102
|
+
sumByB,
|
|
103
|
+
mergeFromB,
|
|
104
|
+
mergeToB,
|
|
105
|
+
selectionB,
|
|
106
|
+
// Side B setters
|
|
107
|
+
setExpressionB,
|
|
108
|
+
setFromB,
|
|
109
|
+
setToB,
|
|
110
|
+
setTimeSelectionB,
|
|
111
|
+
setSumByB,
|
|
112
|
+
setMergeFromB,
|
|
113
|
+
setMergeToB,
|
|
114
|
+
setSelectionB,
|
|
115
|
+
// Compare flags
|
|
116
|
+
setCompareA,
|
|
117
|
+
setCompareB,
|
|
118
|
+
setCompareAbsolute,
|
|
119
|
+
]
|
|
91
120
|
);
|
|
92
121
|
|
|
93
|
-
|
|
94
|
-
const
|
|
122
|
+
// Derive isCompareMode from flags
|
|
123
|
+
const isCompareMode = compareA === 'true' || compareB === 'true';
|
|
124
|
+
const isCompareAbsolute = compareAbsolute === 'true';
|
|
95
125
|
|
|
96
126
|
return {
|
|
97
127
|
isCompareMode,
|