@parca/profile 0.16.449 → 0.16.451
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/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +1 -1
- package/dist/MetricsGraphStrips/AreaGraph/index.d.ts +1 -1
- package/dist/MetricsGraphStrips/AreaGraph/index.d.ts.map +1 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts +2 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts.map +1 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.js +8 -1
- package/dist/MetricsGraphStrips/index.d.ts +2 -1
- package/dist/MetricsGraphStrips/index.d.ts.map +1 -1
- package/dist/MetricsGraphStrips/index.js +13 -3
- package/dist/ProfileIcicleGraph/IcicleGraph/index.js +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +2 -2
- package/dist/ProfileIcicleGraph/index.js +2 -2
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts.map +1 -0
- package/dist/{components → ProfileView/components}/ActionButtons/GroupByDropdown.js +1 -1
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -0
- package/dist/{components → ProfileView/components}/ActionButtons/SortByDropdown.js +2 -2
- package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -0
- package/dist/ProfileView/{ColorStackLegend.js → components/ColorStackLegend.js} +2 -2
- package/dist/ProfileView/components/DashboardItems/index.d.ts +26 -0
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -0
- package/dist/ProfileView/components/DashboardItems/index.js +42 -0
- package/dist/ProfileView/components/DashboardLayout/index.d.ts +15 -0
- package/dist/ProfileView/components/DashboardLayout/index.d.ts.map +1 -0
- package/dist/ProfileView/components/DashboardLayout/index.js +20 -0
- package/dist/ProfileView/components/DiffLegend.d.ts.map +1 -0
- package/dist/ProfileView/components/FilterByFunctionButton.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileHeader/index.d.ts +9 -0
- package/dist/ProfileView/components/ProfileHeader/index.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileHeader/index.js +12 -0
- package/dist/ProfileView/components/ShareButton/ResultBox.d.ts.map +1 -0
- package/dist/{components → ProfileView/components}/ShareButton/index.d.ts +1 -1
- package/dist/ProfileView/components/ShareButton/index.d.ts.map +1 -0
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -0
- package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.js +2 -2
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -0
- package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.js +4 -4
- package/dist/ProfileView/components/Toolbars/index.d.ts +41 -0
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -0
- package/dist/ProfileView/components/Toolbars/index.js +24 -0
- package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts.map +1 -0
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -0
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts +21 -0
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -0
- package/dist/ProfileView/components/VisualizationContainer/index.js +8 -0
- package/dist/ProfileView/{VisualizationPanel.d.ts → components/VisualizationPanel.d.ts} +4 -3
- package/dist/ProfileView/components/VisualizationPanel.d.ts.map +1 -0
- package/dist/ProfileView/context/DashboardContext.d.ts +12 -0
- package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -0
- package/dist/ProfileView/context/DashboardContext.js +39 -0
- package/dist/ProfileView/{ProfileViewContext.d.ts → context/ProfileViewContext.d.ts} +1 -1
- package/dist/ProfileView/context/ProfileViewContext.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useGraphviz.d.ts +12 -0
- package/dist/ProfileView/hooks/useGraphviz.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useGraphviz.js +42 -0
- package/dist/ProfileView/hooks/useProfileMetadata.d.ts +17 -0
- package/dist/ProfileView/hooks/useProfileMetadata.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useProfileMetadata.js +30 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +14 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useVisualizationState.js +52 -0
- package/dist/ProfileView/index.d.ts +2 -49
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +54 -173
- package/dist/ProfileView/types/visualization.d.ts +49 -0
- package/dist/ProfileView/types/visualization.d.ts.map +1 -0
- package/dist/ProfileView/types/visualization.js +13 -0
- package/dist/ProfileView/utils/colorUtils.d.ts +3 -0
- package/dist/ProfileView/utils/colorUtils.d.ts.map +1 -0
- package/dist/ProfileView/utils/colorUtils.js +21 -0
- package/dist/ProfileViewWithData.d.ts +2 -1
- package/dist/ProfileViewWithData.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +2 -2
- package/dist/SourceView/Highlighter.js +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/TimelineGuide/index.d.ts +11 -0
- package/dist/TimelineGuide/index.d.ts.map +1 -0
- package/dist/{MetricsGraphStrips/TimelineGuide → TimelineGuide}/index.js +3 -13
- package/dist/TopTable/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +1 -1
- package/src/MetricsGraphStrips/AreaGraph/index.tsx +2 -2
- package/src/MetricsGraphStrips/MetricsGraphStrips.stories.tsx +11 -2
- package/src/MetricsGraphStrips/index.tsx +16 -4
- package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +1 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +2 -2
- package/src/ProfileIcicleGraph/index.tsx +2 -2
- package/src/{components → ProfileView/components}/ActionButtons/GroupByDropdown.tsx +1 -1
- package/src/{components → ProfileView/components}/ActionButtons/SortByDropdown.tsx +2 -2
- package/src/ProfileView/{ColorStackLegend.tsx → components/ColorStackLegend.tsx} +2 -2
- package/src/ProfileView/components/DashboardItems/index.tsx +148 -0
- package/src/ProfileView/components/DashboardLayout/index.tsx +96 -0
- package/src/ProfileView/components/ProfileHeader/index.tsx +68 -0
- package/src/{components → ProfileView/components}/ShareButton/index.tsx +1 -1
- package/src/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.tsx +2 -6
- package/src/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.tsx +4 -4
- package/src/ProfileView/components/Toolbars/index.tsx +193 -0
- package/src/ProfileView/components/VisualizationContainer/index.tsx +68 -0
- package/src/ProfileView/{VisualizationPanel.tsx → components/VisualizationPanel.tsx} +5 -3
- package/src/ProfileView/context/DashboardContext.tsx +61 -0
- package/src/ProfileView/{ProfileViewContext.tsx → context/ProfileViewContext.tsx} +1 -1
- package/src/ProfileView/hooks/useGraphviz.ts +69 -0
- package/src/ProfileView/hooks/useProfileMetadata.ts +59 -0
- package/src/ProfileView/hooks/useVisualizationState.ts +82 -0
- package/src/ProfileView/index.tsx +126 -451
- package/src/ProfileView/types/visualization.ts +75 -0
- package/src/ProfileView/utils/colorUtils.ts +24 -0
- package/src/ProfileViewWithData.tsx +3 -0
- package/src/SourceView/Highlighter.tsx +1 -1
- package/src/Table/index.tsx +1 -1
- package/src/{MetricsGraphStrips/TimelineGuide → TimelineGuide}/index.tsx +7 -17
- package/src/TopTable/index.tsx +1 -1
- package/src/utils.ts +2 -0
- package/dist/MetricsGraphStrips/TimelineGuide/index.d.ts +0 -10
- package/dist/MetricsGraphStrips/TimelineGuide/index.d.ts.map +0 -1
- package/dist/ProfileView/ColorStackLegend.d.ts.map +0 -1
- package/dist/ProfileView/ProfileViewContext.d.ts.map +0 -1
- package/dist/ProfileView/VisualizationPanel.d.ts.map +0 -1
- package/dist/components/ActionButtons/GroupByDropdown.d.ts.map +0 -1
- package/dist/components/ActionButtons/SortByDropdown.d.ts.map +0 -1
- package/dist/components/DiffLegend.d.ts.map +0 -1
- package/dist/components/FilterByFunctionButton.d.ts.map +0 -1
- package/dist/components/ShareButton/ResultBox.d.ts.map +0 -1
- package/dist/components/ShareButton/index.d.ts.map +0 -1
- package/dist/components/ViewSelector/Dropdown.d.ts.map +0 -1
- package/dist/components/ViewSelector/index.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/MultiLevelDropdown.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/TableColumnsDropdown.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/index.d.ts +0 -37
- package/dist/components/VisualisationToolbar/index.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/index.js +0 -64
- package/src/components/VisualisationToolbar/index.tsx +0 -228
- /package/dist/{components → ProfileView/components}/ActionButtons/GroupByDropdown.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ActionButtons/SortByDropdown.d.ts +0 -0
- /package/dist/ProfileView/{ColorStackLegend.d.ts → components/ColorStackLegend.d.ts} +0 -0
- /package/dist/{components → ProfileView/components}/DiffLegend.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/DiffLegend.js +0 -0
- /package/dist/{components → ProfileView/components}/FilterByFunctionButton.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/FilterByFunctionButton.js +0 -0
- /package/dist/{components → ProfileView/components}/ShareButton/ResultBox.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ShareButton/ResultBox.js +0 -0
- /package/dist/{components → ProfileView/components}/ShareButton/index.js +0 -0
- /package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.d.ts +0 -0
- /package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/Dropdown.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/Dropdown.js +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/index.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/index.js +0 -0
- /package/dist/ProfileView/{VisualizationPanel.js → components/VisualizationPanel.js} +0 -0
- /package/dist/ProfileView/{ProfileViewContext.js → context/ProfileViewContext.js} +0 -0
- /package/src/{components → ProfileView/components}/DiffLegend.tsx +0 -0
- /package/src/{components → ProfileView/components}/FilterByFunctionButton.tsx +0 -0
- /package/src/{components → ProfileView/components}/ShareButton/ResultBox.tsx +0 -0
- /package/src/{components → ProfileView/components}/ViewSelector/Dropdown.tsx +0 -0
- /package/src/{components → ProfileView/components}/ViewSelector/index.tsx +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright 2022 The Parca Authors
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { createContext, useContext } from 'react';
|
|
15
|
+
import { useURLState } from '@parca/components';
|
|
16
|
+
const DashboardContext = createContext(undefined);
|
|
17
|
+
export const DashboardProvider = ({ children }) => {
|
|
18
|
+
const [dashboardItems, setDashboardItems] = useURLState('dashboard_items', {
|
|
19
|
+
alwaysReturnArray: true,
|
|
20
|
+
});
|
|
21
|
+
const handleClosePanel = (visualizationType) => {
|
|
22
|
+
const newDashboardItems = dashboardItems.filter(item => item !== visualizationType);
|
|
23
|
+
setDashboardItems(newDashboardItems);
|
|
24
|
+
};
|
|
25
|
+
const isMultiPanelView = dashboardItems.length > 1;
|
|
26
|
+
return (_jsx(DashboardContext.Provider, { value: {
|
|
27
|
+
dashboardItems,
|
|
28
|
+
setDashboardItems,
|
|
29
|
+
handleClosePanel,
|
|
30
|
+
isMultiPanelView,
|
|
31
|
+
}, children: children }));
|
|
32
|
+
};
|
|
33
|
+
export const useDashboard = () => {
|
|
34
|
+
const context = useContext(DashboardContext);
|
|
35
|
+
if (context === undefined) {
|
|
36
|
+
throw new Error('useDashboard must be used within a DashboardProvider');
|
|
37
|
+
}
|
|
38
|
+
return context;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileViewContext.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/context/ProfileViewContext.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,SAAS,EAA4B,MAAM,OAAO,CAAC;AAE3D,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD,UAAU,KAAK;IACb,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,EAAE,KAG1B,CAAC;AAEF,QAAA,MAAM,kBAAkB,gCAAqC,CAAC;AAE9D,eAAO,MAAM,0BAA0B,yBAGpC;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,KAAG,GAAG,CAAC,OAMP,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,KAMxC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Callgraph as CallgraphType } from '@parca/client';
|
|
2
|
+
interface UseGraphvizProps {
|
|
3
|
+
callgraphData?: CallgraphType;
|
|
4
|
+
width?: number;
|
|
5
|
+
colorRange: [string, string];
|
|
6
|
+
}
|
|
7
|
+
export declare const useGraphviz: ({ callgraphData, width, colorRange, }: UseGraphvizProps) => {
|
|
8
|
+
graphvizLoaded: boolean;
|
|
9
|
+
callgraphSVG: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=useGraphviz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGraphviz.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useGraphviz.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,SAAS,IAAI,aAAa,EAAC,MAAM,eAAe,CAAC;AAIzD,UAAU,gBAAgB;IACxB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,0CAIrB,gBAAgB,KAAG;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CAmClC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { useEffect, useState } from 'react';
|
|
14
|
+
import graphviz from 'graphviz-wasm';
|
|
15
|
+
import { jsonToDot } from '../../Callgraph/utils';
|
|
16
|
+
export const useGraphviz = ({ callgraphData, width, colorRange, }) => {
|
|
17
|
+
const [graphvizLoaded, setGraphvizLoaded] = useState(false);
|
|
18
|
+
const [callgraphSVG, setCallgraphSVG] = useState(undefined);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
async function loadGraphviz() {
|
|
21
|
+
await graphviz.loadWASM();
|
|
22
|
+
setGraphvizLoaded(true);
|
|
23
|
+
}
|
|
24
|
+
void loadGraphviz();
|
|
25
|
+
}, []);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
async function loadCallgraphSVG(graph, width, colorRange) {
|
|
28
|
+
await setCallgraphSVG(undefined);
|
|
29
|
+
const dataAsDot = await jsonToDot({
|
|
30
|
+
graph,
|
|
31
|
+
width,
|
|
32
|
+
colorRange,
|
|
33
|
+
});
|
|
34
|
+
const svgGraph = await graphviz.layout(dataAsDot, 'svg', 'dot');
|
|
35
|
+
await setCallgraphSVG(svgGraph);
|
|
36
|
+
}
|
|
37
|
+
if (graphvizLoaded && callgraphData != null && width != null) {
|
|
38
|
+
void loadCallgraphSVG(callgraphData, width, colorRange);
|
|
39
|
+
}
|
|
40
|
+
}, [graphvizLoaded, callgraphData, width, colorRange]);
|
|
41
|
+
return { graphvizLoaded, callgraphSVG };
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Table as ArrowTable } from 'apache-arrow';
|
|
2
|
+
import { FlamegraphArrow } from '@parca/client';
|
|
3
|
+
interface UseProfileMetadataProps {
|
|
4
|
+
flamegraphArrow?: FlamegraphArrow;
|
|
5
|
+
metadataMappingFiles?: string[];
|
|
6
|
+
metadataLoading: boolean;
|
|
7
|
+
colorBy: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const useProfileMetadata: ({ flamegraphArrow, metadataMappingFiles, metadataLoading, colorBy, }: UseProfileMetadataProps) => {
|
|
10
|
+
table: ArrowTable<any> | null;
|
|
11
|
+
mappingsList: string[];
|
|
12
|
+
filenamesList: string[];
|
|
13
|
+
colorMappings: string[];
|
|
14
|
+
metadataLoading: boolean;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useProfileMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProfileMetadata.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useProfileMetadata.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,KAAK,IAAI,UAAU,EAAe,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAM9C,UAAU,uBAAuB;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,yEAK5B,uBAAuB,KAAG;IAC3B,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;CAkB1B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { useMemo } from 'react';
|
|
14
|
+
import { tableFromIPC } from 'apache-arrow';
|
|
15
|
+
import useMappingList, { useFilenamesList, } from '../../ProfileIcicleGraph/IcicleGraphArrow/useMappingList';
|
|
16
|
+
export const useProfileMetadata = ({ flamegraphArrow, metadataMappingFiles, metadataLoading, colorBy, }) => {
|
|
17
|
+
const table = useMemo(() => {
|
|
18
|
+
return flamegraphArrow !== undefined ? tableFromIPC(flamegraphArrow.record) : null;
|
|
19
|
+
}, [flamegraphArrow]);
|
|
20
|
+
const mappingsList = useMappingList(metadataMappingFiles);
|
|
21
|
+
const filenamesList = useFilenamesList(table);
|
|
22
|
+
const colorMappings = colorBy === 'binary' ? mappingsList : filenamesList;
|
|
23
|
+
return {
|
|
24
|
+
table,
|
|
25
|
+
mappingsList,
|
|
26
|
+
filenamesList,
|
|
27
|
+
colorMappings,
|
|
28
|
+
metadataLoading,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const useVisualizationState: () => {
|
|
2
|
+
curPath: string[];
|
|
3
|
+
setCurPath: (path: string[]) => void;
|
|
4
|
+
currentSearchString: string | undefined;
|
|
5
|
+
setSearchString: (searchString: string | undefined) => void;
|
|
6
|
+
colorStackLegend: string | undefined;
|
|
7
|
+
colorBy: string;
|
|
8
|
+
groupBy: string[];
|
|
9
|
+
setGroupBy: (keys: string[]) => void;
|
|
10
|
+
toggleGroupBy: (key: string) => void;
|
|
11
|
+
clearSelection: () => void;
|
|
12
|
+
setGroupByLabels: (labels: string[]) => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useVisualizationState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVisualizationState.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useVisualizationState.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,qBAAqB,QAAO;IACvC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,eAAe,EAAE,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5D,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAmD9C,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { useCallback, useState } from 'react';
|
|
14
|
+
import { useURLState } from '@parca/components';
|
|
15
|
+
import { FIELD_FUNCTION_NAME, FIELD_LABELS } from '../../ProfileIcicleGraph/IcicleGraphArrow';
|
|
16
|
+
export const useVisualizationState = () => {
|
|
17
|
+
const [curPath, setCurPath] = useState([]);
|
|
18
|
+
const [currentSearchString, setSearchString] = useURLState('search_string');
|
|
19
|
+
const [colorStackLegend] = useURLState('color_stack_legend');
|
|
20
|
+
const [colorBy] = useURLState('color_by');
|
|
21
|
+
const [groupBy, setStoreGroupBy] = useURLState('group_by', {
|
|
22
|
+
defaultValue: [FIELD_FUNCTION_NAME],
|
|
23
|
+
alwaysReturnArray: true,
|
|
24
|
+
});
|
|
25
|
+
const setGroupBy = useCallback((keys) => {
|
|
26
|
+
setStoreGroupBy(keys);
|
|
27
|
+
}, [setStoreGroupBy]);
|
|
28
|
+
const toggleGroupBy = useCallback((key) => {
|
|
29
|
+
groupBy.includes(key)
|
|
30
|
+
? setGroupBy(groupBy.filter(v => v !== key)) // remove
|
|
31
|
+
: setGroupBy([...groupBy, key]); // add
|
|
32
|
+
}, [groupBy, setGroupBy]);
|
|
33
|
+
const setGroupByLabels = useCallback((labels) => {
|
|
34
|
+
setGroupBy(groupBy.filter(l => !l.startsWith(`${FIELD_LABELS}.`)).concat(labels));
|
|
35
|
+
}, [groupBy, setGroupBy]);
|
|
36
|
+
const clearSelection = useCallback(() => {
|
|
37
|
+
setSearchString?.('');
|
|
38
|
+
}, [setSearchString]);
|
|
39
|
+
return {
|
|
40
|
+
curPath,
|
|
41
|
+
setCurPath,
|
|
42
|
+
currentSearchString,
|
|
43
|
+
setSearchString,
|
|
44
|
+
colorStackLegend,
|
|
45
|
+
colorBy: colorBy ?? '',
|
|
46
|
+
groupBy,
|
|
47
|
+
setGroupBy,
|
|
48
|
+
toggleGroupBy,
|
|
49
|
+
setGroupByLabels,
|
|
50
|
+
clearSelection,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface FlamegraphData {
|
|
4
|
-
loading: boolean;
|
|
5
|
-
data?: Flamegraph;
|
|
6
|
-
arrow?: FlamegraphArrow;
|
|
7
|
-
total?: bigint;
|
|
8
|
-
filtered?: bigint;
|
|
9
|
-
error?: any;
|
|
10
|
-
metadataMappingFiles?: string[];
|
|
11
|
-
metadataLoading: boolean;
|
|
12
|
-
metadataLabels?: string[];
|
|
13
|
-
}
|
|
14
|
-
export interface TopTableData {
|
|
15
|
-
loading: boolean;
|
|
16
|
-
arrow?: TableArrow;
|
|
17
|
-
data?: Top;
|
|
18
|
-
total?: bigint;
|
|
19
|
-
filtered?: bigint;
|
|
20
|
-
error?: any;
|
|
21
|
-
unit?: string;
|
|
22
|
-
}
|
|
23
|
-
interface CallgraphData {
|
|
24
|
-
loading: boolean;
|
|
25
|
-
data?: CallgraphType;
|
|
26
|
-
total?: bigint;
|
|
27
|
-
filtered?: bigint;
|
|
28
|
-
error?: any;
|
|
29
|
-
}
|
|
30
|
-
interface SourceData {
|
|
31
|
-
loading: boolean;
|
|
32
|
-
data?: Source;
|
|
33
|
-
error?: any;
|
|
34
|
-
}
|
|
35
|
-
export interface ProfileViewProps {
|
|
36
|
-
total: bigint;
|
|
37
|
-
filtered: bigint;
|
|
38
|
-
flamegraphData: FlamegraphData;
|
|
39
|
-
topTableData?: TopTableData;
|
|
40
|
-
callgraphData?: CallgraphData;
|
|
41
|
-
sourceData?: SourceData;
|
|
42
|
-
profileSource?: ProfileSource;
|
|
43
|
-
queryClient?: QueryServiceClient;
|
|
44
|
-
compare?: boolean;
|
|
45
|
-
onDownloadPProf: () => void;
|
|
46
|
-
pprofDownloading?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export declare const ProfileView: ({ total, filtered, flamegraphData, topTableData, callgraphData, sourceData, profileSource, queryClient, onDownloadPProf, pprofDownloading, compare, }: ProfileViewProps) => JSX.Element;
|
|
49
|
-
export {};
|
|
1
|
+
import type { ProfileViewProps } from './types/visualization';
|
|
2
|
+
export declare const ProfileView: ({ total, filtered, flamegraphData, topTableData, callgraphData, sourceData, profileSource, queryClient, onDownloadPProf, pprofDownloading, compare, showVisualizationSelector, }: ProfileViewProps) => JSX.Element;
|
|
50
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileView/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileView/index.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAC,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAG/E,eAAO,MAAM,WAAW,qLAarB,gBAAgB,KAAG,GAAG,CAAC,OAwIzB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
// Copyright 2022 The Parca Authors
|
|
4
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -12,183 +11,65 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
12
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
12
|
// See the License for the specific language governing permissions and
|
|
14
13
|
// limitations under the License.
|
|
15
|
-
import {
|
|
16
|
-
import { tableFromIPC } from 'apache-arrow';
|
|
17
|
-
import cx from 'classnames';
|
|
18
|
-
import { scaleLinear } from 'd3';
|
|
19
|
-
import graphviz from 'graphviz-wasm';
|
|
20
|
-
import { DragDropContext, Draggable, Droppable, } from 'react-beautiful-dnd';
|
|
21
|
-
import { ConditionalWrapper, KeyDownProvider, useParcaContext, useURLState } from '@parca/components';
|
|
14
|
+
import { KeyDownProvider, useParcaContext } from '@parca/components';
|
|
22
15
|
import { useContainerDimensions } from '@parca/hooks';
|
|
23
16
|
import { selectDarkMode, useAppSelector } from '@parca/store';
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Array.isArray(b) &&
|
|
39
|
-
a.length === b.length &&
|
|
40
|
-
a.every((val, index) => val === b[index]));
|
|
41
|
-
}
|
|
42
|
-
export const ProfileView = ({ total, filtered, flamegraphData, topTableData, callgraphData, sourceData, profileSource, queryClient, onDownloadPProf, pprofDownloading, compare, }) => {
|
|
43
|
-
const { timezone } = useParcaContext();
|
|
17
|
+
import { selectQueryParam } from '@parca/utilities';
|
|
18
|
+
import ColorStackLegend from './components/ColorStackLegend';
|
|
19
|
+
import { getDashboardItem } from './components/DashboardItems';
|
|
20
|
+
import { DashboardLayout } from './components/DashboardLayout';
|
|
21
|
+
import { ProfileHeader } from './components/ProfileHeader';
|
|
22
|
+
import { IcicleGraphToolbar, TableToolbar, VisualisationToolbar } from './components/Toolbars';
|
|
23
|
+
import { DashboardProvider } from './context/DashboardContext';
|
|
24
|
+
import { ProfileViewContextProvider } from './context/ProfileViewContext';
|
|
25
|
+
import { useGraphviz } from './hooks/useGraphviz';
|
|
26
|
+
import { useProfileMetadata } from './hooks/useProfileMetadata';
|
|
27
|
+
import { useVisualizationState } from './hooks/useVisualizationState';
|
|
28
|
+
import { getColorRange } from './utils/colorUtils';
|
|
29
|
+
export const ProfileView = ({ total, filtered, flamegraphData, topTableData, callgraphData, sourceData, profileSource, queryClient, onDownloadPProf, pprofDownloading, compare, showVisualizationSelector, }) => {
|
|
30
|
+
const { timezone, perf, profileViewExternalMainActions, preferencesModal, profileViewExternalSubActions, } = useParcaContext();
|
|
44
31
|
const { ref, dimensions } = useContainerDimensions();
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
32
|
+
const isDarkMode = useAppSelector(selectDarkMode);
|
|
33
|
+
const colorRange = getColorRange(isDarkMode);
|
|
34
|
+
const { curPath, setCurPath, currentSearchString, setSearchString, colorStackLegend, colorBy, groupBy, toggleGroupBy, clearSelection, setGroupByLabels, } = useVisualizationState();
|
|
35
|
+
const { callgraphSVG } = useGraphviz({
|
|
36
|
+
callgraphData: callgraphData?.data,
|
|
37
|
+
width: dimensions?.width,
|
|
38
|
+
colorRange,
|
|
39
|
+
});
|
|
40
|
+
const { colorMappings } = useProfileMetadata({
|
|
41
|
+
flamegraphArrow: flamegraphData.arrow,
|
|
42
|
+
metadataMappingFiles: flamegraphData.metadataMappingFiles,
|
|
43
|
+
metadataLoading: flamegraphData.metadataLoading,
|
|
44
|
+
colorBy,
|
|
48
45
|
});
|
|
49
|
-
const [graphvizLoaded, setGraphvizLoaded] = useState(false);
|
|
50
|
-
const [callgraphSVG, setCallgraphSVG] = useState(undefined);
|
|
51
|
-
const [currentSearchString, setSearchString] = useURLState('search_string');
|
|
52
|
-
const [colorStackLegend] = useURLState('color_stack_legend');
|
|
53
|
-
const [colorBy] = useURLState('color_by');
|
|
54
46
|
const isColorStackLegendEnabled = colorStackLegend === 'true';
|
|
55
|
-
const colorByValue = colorBy === undefined || colorBy === '' ? 'binary' : colorBy;
|
|
56
|
-
const isDarkMode = useAppSelector(selectDarkMode);
|
|
57
|
-
const isMultiPanelView = dashboardItems.length > 1;
|
|
58
|
-
const table = useMemo(() => {
|
|
59
|
-
return flamegraphData.arrow !== undefined ? tableFromIPC(flamegraphData.arrow.record) : null;
|
|
60
|
-
}, [flamegraphData.arrow]);
|
|
61
|
-
const mappingsList = useMappingList(flamegraphData.metadataMappingFiles);
|
|
62
|
-
const filenamesList = useFilenamesList(table);
|
|
63
|
-
const { perf, profileViewExternalMainActions } = useParcaContext();
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
// Reset the current path when the profile source changes
|
|
66
|
-
setCurPath([]);
|
|
67
|
-
}, [profileSource]);
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
async function loadGraphviz() {
|
|
70
|
-
await graphviz.loadWASM();
|
|
71
|
-
setGraphvizLoaded(true);
|
|
72
|
-
}
|
|
73
|
-
void loadGraphviz();
|
|
74
|
-
}, []);
|
|
75
|
-
const maxColor = getNewSpanColor(isDarkMode);
|
|
76
|
-
const minColor = scaleLinear([isDarkMode ? 'black' : 'white', maxColor])(0.3);
|
|
77
|
-
const colorRange = [minColor, maxColor];
|
|
78
|
-
// Note: If we want to further optimize the experience, we could try to load the graphviz layout in the ProfileViewWithData layer
|
|
79
|
-
// and pass it down to the ProfileView. This would allow us to load the layout in parallel with the flamegraph data.
|
|
80
|
-
// However, the layout calculation is dependent on the width and color range of the graph container, which is why it is done at this level
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
async function loadCallgraphSVG(graph, width, colorRange) {
|
|
83
|
-
await setCallgraphSVG(undefined);
|
|
84
|
-
// Translate JSON to 'dot' graph string
|
|
85
|
-
const dataAsDot = await jsonToDot({
|
|
86
|
-
graph,
|
|
87
|
-
width,
|
|
88
|
-
colorRange,
|
|
89
|
-
});
|
|
90
|
-
// Use Graphviz-WASM to translate the 'dot' graph to a 'JSON' graph
|
|
91
|
-
const svgGraph = await graphviz.layout(dataAsDot, 'svg', 'dot');
|
|
92
|
-
await setCallgraphSVG(svgGraph);
|
|
93
|
-
}
|
|
94
|
-
if (graphvizLoaded &&
|
|
95
|
-
callgraphData?.data !== null &&
|
|
96
|
-
callgraphData?.data !== undefined &&
|
|
97
|
-
dimensions?.width !== undefined) {
|
|
98
|
-
void loadCallgraphSVG(callgraphData?.data, dimensions?.width, colorRange);
|
|
99
|
-
}
|
|
100
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
-
}, [graphvizLoaded, callgraphData?.data]);
|
|
102
|
-
const setNewCurPath = (path) => {
|
|
103
|
-
if (!arrayEquals(curPath, path)) {
|
|
104
|
-
setCurPath(path);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const getDashboardItemByType = ({ type, isHalfScreen, }) => {
|
|
108
|
-
switch (type) {
|
|
109
|
-
case 'icicle': {
|
|
110
|
-
return (_jsx(ConditionalWrapper, { condition: perf?.onRender != null, WrapperComponent: Profiler, wrapperProps: {
|
|
111
|
-
id: 'icicleGraph',
|
|
112
|
-
onRender: perf?.onRender,
|
|
113
|
-
}, children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, arrow: flamegraphData?.arrow, graph: flamegraphData?.data, total: total, filtered: filtered, profileType: profileSource?.ProfileType(), loading: flamegraphData.loading, error: flamegraphData.error, isHalfScreen: isHalfScreen, width: dimensions?.width !== undefined
|
|
114
|
-
? isHalfScreen
|
|
115
|
-
? (dimensions.width - 54) / 2
|
|
116
|
-
: dimensions.width - 16
|
|
117
|
-
: 0, metadataMappingFiles: flamegraphData.metadataMappingFiles, metadataLoading: flamegraphData.metadataLoading }) }));
|
|
118
|
-
}
|
|
119
|
-
case 'callgraph': {
|
|
120
|
-
return callgraphData?.data !== undefined &&
|
|
121
|
-
callgraphSVG !== undefined &&
|
|
122
|
-
dimensions?.width !== undefined ? (_jsx(Callgraph, { data: callgraphData.data, svgString: callgraphSVG, profileType: profileSource?.ProfileType(), width: isHalfScreen ? dimensions?.width / 2 : dimensions?.width })) : (_jsx(_Fragment, {}));
|
|
123
|
-
}
|
|
124
|
-
case 'table': {
|
|
125
|
-
return topTableData != null ? (_jsx(Table, { total: total, filtered: filtered, loading: topTableData.loading, data: topTableData.arrow?.record, unit: topTableData.unit, profileType: profileSource?.ProfileType(), currentSearchString: currentSearchString, setSearchString: setSearchString, isHalfScreen: isHalfScreen, metadataMappingFiles: flamegraphData.metadataMappingFiles })) : (_jsx(_Fragment, {}));
|
|
126
|
-
}
|
|
127
|
-
case 'source': {
|
|
128
|
-
return sourceData != null ? (_jsx(SourceView, { loading: sourceData.loading, data: sourceData.data, total: total, filtered: filtered })) : (_jsx(_Fragment, {}));
|
|
129
|
-
}
|
|
130
|
-
default: {
|
|
131
|
-
return _jsx(_Fragment, {});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const handleClosePanel = (visualizationType) => {
|
|
136
|
-
const newDashboardItems = dashboardItems.filter(item => item !== visualizationType);
|
|
137
|
-
setDashboardItems(newDashboardItems);
|
|
138
|
-
};
|
|
139
|
-
const onDragEnd = (result) => {
|
|
140
|
-
const { destination, source, draggableId } = result;
|
|
141
|
-
if (Boolean(destination) && destination?.index !== source.index) {
|
|
142
|
-
const targetItem = draggableId;
|
|
143
|
-
const otherItems = dashboardItems.filter(item => item !== targetItem);
|
|
144
|
-
const newDashboardItems = destination.index < source.index
|
|
145
|
-
? [targetItem, ...otherItems]
|
|
146
|
-
: [...otherItems, targetItem];
|
|
147
|
-
setDashboardItems(newDashboardItems);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
// TODO: this is just a placeholder, we need to replace with an actually informative and accurate title (cc @metalmatze)
|
|
151
|
-
const profileSourceString = profileSource?.toString(timezone);
|
|
152
|
-
const hasProfileSource = profileSource !== undefined && profileSourceString !== '';
|
|
153
|
-
const headerParts = profileSourceString?.split('"') ?? [];
|
|
154
47
|
const compareMode = compare === true ||
|
|
155
48
|
(selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true');
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
49
|
+
const getDashboardItemByType = ({ type, isHalfScreen, }) => {
|
|
50
|
+
return getDashboardItem({
|
|
51
|
+
type,
|
|
52
|
+
isHalfScreen,
|
|
53
|
+
dimensions,
|
|
54
|
+
flamegraphData,
|
|
55
|
+
topTableData,
|
|
56
|
+
callgraphData,
|
|
57
|
+
sourceData,
|
|
58
|
+
profileSource,
|
|
59
|
+
total,
|
|
60
|
+
filtered,
|
|
61
|
+
curPath,
|
|
62
|
+
setNewCurPath: setCurPath,
|
|
63
|
+
currentSearchString,
|
|
64
|
+
setSearchString,
|
|
65
|
+
callgraphSVG,
|
|
66
|
+
perf,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const actionButtons = {
|
|
70
|
+
icicle: _jsx(IcicleGraphToolbar, { curPath: curPath, setNewCurPath: setCurPath }),
|
|
71
|
+
table: (_jsx(TableToolbar, { profileType: profileSource?.ProfileType(), total: total, filtered: filtered, clearSelection: clearSelection, currentSearchString: currentSearchString })),
|
|
178
72
|
};
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
: 'justify-end', {
|
|
182
|
-
'items-end mb-4': !hasProfileSource && profileViewExternalMainActions != null,
|
|
183
|
-
'items-center mb-2': hasProfileSource,
|
|
184
|
-
}), children: _jsxs("div", { children: [hasProfileSource && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: "text-xs font-medium", children: headerParts.length > 0 ? headerParts[0].replace(/"/g, '') : '' }), _jsx("div", { className: "text-xs font-medium", children: headerParts.length > 1
|
|
185
|
-
? headerParts[headerParts.length - 1].replace(/"/g, '')
|
|
186
|
-
: '' })] })), profileViewExternalMainActions != null ? profileViewExternalMainActions : null] }) }), _jsx(VisualisationToolbar, { groupBy: groupBy, toggleGroupBy: toggleGroupBy, hasProfileSource: hasProfileSource, pprofdownloading: pprofDownloading, profileSource: profileSource, queryClient: queryClient, onDownloadPProf: onDownloadPProf, isMultiPanelView: isMultiPanelView, dashboardItems: dashboardItems, curPath: curPath, setNewCurPath: setNewCurPath, profileType: profileSource?.ProfileType(), total: total, filtered: filtered, currentSearchString: currentSearchString, setSearchString: setSearchString, groupByLabels: flamegraphData.metadataLabels ?? [] }), isColorStackLegendEnabled && (_jsx(ColorStackLegend, { compareMode: compareMode, mappings: colorByValue === 'binary' ? mappingsList : filenamesList, loading: flamegraphData.metadataLoading })), _jsx("div", { className: "w-full", ref: ref, children: _jsx(DragDropContext, { onDragEnd: onDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "horizontal", children: provided => (_jsx("div", { ref: provided.innerRef, className: cx('grid w-full gap-2', isMultiPanelView ? 'grid-cols-2' : 'grid-cols-1'), ...provided.droppableProps, children: dashboardItems.map((dashboardItem, index) => {
|
|
187
|
-
return (_jsx(Draggable, { draggableId: dashboardItem, index: index, isDragDisabled: !isMultiPanelView, children: (provided, snapshot) => (_createElement("div", { ref: provided.innerRef, ...provided.draggableProps, key: dashboardItem, className: cx('w-full min-h-96', snapshot.isDragging
|
|
188
|
-
? 'bg-gray-200 dark:bg-gray-500'
|
|
189
|
-
: 'bg-white dark:bg-gray-900', isMultiPanelView
|
|
190
|
-
? 'border-2 border-gray-100 dark:border-gray-700 rounded-md p-3'
|
|
191
|
-
: '') },
|
|
192
|
-
_jsx(VisualizationPanel, { handleClosePanel: handleClosePanel, isMultiPanelView: isMultiPanelView, dashboardItem: dashboardItem, getDashboardItemByType: getDashboardItemByType, dragHandleProps: provided.dragHandleProps, index: index, actionButtons: getActionButtonsWithMultiPanelView() }))) }, dashboardItem));
|
|
193
|
-
}) })) }) }) })] }) }));
|
|
73
|
+
const hasProfileSource = profileSource !== undefined && profileSource.toString(timezone) !== '';
|
|
74
|
+
return (_jsx(KeyDownProvider, { children: _jsx(ProfileViewContextProvider, { value: { profileSource, compareMode }, children: _jsxs(DashboardProvider, { children: [_jsx(ProfileHeader, { profileSourceString: profileSource?.toString(timezone), hasProfileSource: hasProfileSource, externalMainActions: profileViewExternalMainActions }), _jsx(VisualisationToolbar, { groupBy: groupBy, toggleGroupBy: toggleGroupBy, hasProfileSource: hasProfileSource, pprofdownloading: pprofDownloading, profileSource: profileSource, queryClient: queryClient, onDownloadPProf: onDownloadPProf, curPath: curPath, setNewCurPath: setCurPath, profileType: profileSource?.ProfileType(), total: total, filtered: filtered, currentSearchString: currentSearchString, setSearchString: setSearchString, groupByLabels: flamegraphData.metadataLabels ?? [], preferencesModal: preferencesModal, profileViewExternalSubActions: profileViewExternalSubActions, clearSelection: clearSelection, setGroupByLabels: setGroupByLabels, showVisualizationSelector: showVisualizationSelector }), isColorStackLegendEnabled && (_jsx(ColorStackLegend, { compareMode: compareMode, mappings: colorMappings, loading: flamegraphData.metadataLoading })), _jsx("div", { className: "w-full", ref: ref, children: _jsx(DashboardLayout, { getDashboardItemByType: getDashboardItemByType, actionButtons: actionButtons }) })] }) }) }));
|
|
194
75
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Callgraph as CallgraphType, Flamegraph, FlamegraphArrow, QueryServiceClient, Source, TableArrow } from '@parca/client';
|
|
2
|
+
import { ProfileSource } from '../../ProfileSource';
|
|
3
|
+
export interface FlamegraphData {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
data?: Flamegraph;
|
|
6
|
+
arrow?: FlamegraphArrow;
|
|
7
|
+
total?: bigint;
|
|
8
|
+
filtered?: bigint;
|
|
9
|
+
error?: any;
|
|
10
|
+
metadataMappingFiles?: string[];
|
|
11
|
+
metadataLoading: boolean;
|
|
12
|
+
metadataLabels?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface TopTableData {
|
|
15
|
+
loading: boolean;
|
|
16
|
+
arrow?: TableArrow;
|
|
17
|
+
total?: bigint;
|
|
18
|
+
filtered?: bigint;
|
|
19
|
+
error?: any;
|
|
20
|
+
unit?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CallgraphData {
|
|
23
|
+
loading: boolean;
|
|
24
|
+
data?: CallgraphType;
|
|
25
|
+
total?: bigint;
|
|
26
|
+
filtered?: bigint;
|
|
27
|
+
error?: any;
|
|
28
|
+
}
|
|
29
|
+
export interface SourceData {
|
|
30
|
+
loading: boolean;
|
|
31
|
+
data?: Source;
|
|
32
|
+
error?: any;
|
|
33
|
+
}
|
|
34
|
+
export type VisualizationType = 'icicle' | 'callgraph' | 'table' | 'source';
|
|
35
|
+
export interface ProfileViewProps {
|
|
36
|
+
total: bigint;
|
|
37
|
+
filtered: bigint;
|
|
38
|
+
flamegraphData: FlamegraphData;
|
|
39
|
+
topTableData?: TopTableData;
|
|
40
|
+
callgraphData?: CallgraphData;
|
|
41
|
+
sourceData?: SourceData;
|
|
42
|
+
profileSource?: ProfileSource;
|
|
43
|
+
queryClient?: QueryServiceClient;
|
|
44
|
+
compare?: boolean;
|
|
45
|
+
onDownloadPProf: () => void;
|
|
46
|
+
pprofDownloading?: boolean;
|
|
47
|
+
showVisualizationSelector?: boolean;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=visualization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualization.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/types/visualization.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,cAAc,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorUtils.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/utils/colorUtils.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,eAAgB,OAAO,KAAG,CAAC,MAAM,EAAE,MAAM,CAIlE,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,OAAO,KAAG,MAErD,CAAC"}
|