@parca/profile 0.16.142 → 0.16.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/Callgraph/index.js +1 -1
  3. package/dist/GraphTooltip/index.js +1 -1
  4. package/dist/MatchersInput/index.js +1 -1
  5. package/dist/MetricsGraph/MetricsTooltip/index.js +1 -1
  6. package/dist/MetricsGraph/index.js +2 -2
  7. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts +1 -1
  8. package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts +1 -1
  9. package/dist/ProfileExplorer/index.d.ts +1 -1
  10. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.d.ts +1 -1
  11. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.js +1 -1
  12. package/dist/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.js +1 -1
  13. package/dist/ProfileIcicleGraph/IcicleGraph/index.d.ts +1 -1
  14. package/dist/ProfileIcicleGraph/IcicleGraph/index.js +1 -1
  15. package/dist/ProfileIcicleGraph/IcicleGraph/useColoredGraph.js +1 -1
  16. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.js +1 -1
  17. package/dist/ProfileIcicleGraph/IcicleGraph/utils.js +1 -1
  18. package/dist/ProfileIcicleGraph/index.d.ts +4 -2
  19. package/dist/ProfileIcicleGraph/index.js +19 -17
  20. package/dist/ProfileMetricsGraph/index.js +1 -1
  21. package/dist/ProfileSelector/index.js +1 -1
  22. package/dist/ProfileSource.js +1 -1
  23. package/dist/ProfileView/FilterByFunctionButton.d.ts +1 -1
  24. package/dist/ProfileView/ViewSelector.d.ts +1 -1
  25. package/dist/ProfileView/ViewSelector.js +1 -1
  26. package/dist/ProfileView/VisualizationPanel.d.ts +1 -1
  27. package/dist/ProfileView/index.d.ts +2 -0
  28. package/dist/ProfileView/index.js +4 -3
  29. package/dist/ProfileViewWithData.d.ts +1 -1
  30. package/dist/ProfileViewWithData.js +13 -11
  31. package/dist/TopTable/index.d.ts +1 -1
  32. package/dist/TopTable/index.js +1 -1
  33. package/dist/components/DiffLegend.js +1 -1
  34. package/package.json +8 -6
  35. package/src/Callgraph/index.tsx +1 -1
  36. package/src/GraphTooltip/index.tsx +1 -1
  37. package/src/MatchersInput/index.tsx +1 -1
  38. package/src/MetricsGraph/MetricsTooltip/index.tsx +1 -1
  39. package/src/MetricsGraph/index.tsx +2 -2
  40. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +1 -1
  41. package/src/ProfileExplorer/ProfileExplorerSingle.tsx +1 -1
  42. package/src/ProfileExplorer/index.tsx +1 -1
  43. package/src/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.tsx +2 -2
  44. package/src/ProfileIcicleGraph/IcicleGraph/IcicleGraphNodes.tsx +1 -1
  45. package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +1 -1
  46. package/src/ProfileIcicleGraph/IcicleGraph/useColoredGraph.ts +2 -2
  47. package/src/ProfileIcicleGraph/IcicleGraph/useNodeColor.ts +1 -1
  48. package/src/ProfileIcicleGraph/IcicleGraph/utils.ts +1 -1
  49. package/src/ProfileIcicleGraph/index.tsx +50 -22
  50. package/src/ProfileMetricsGraph/index.tsx +1 -1
  51. package/src/ProfileSelector/index.tsx +1 -1
  52. package/src/ProfileSource.tsx +1 -1
  53. package/src/ProfileView/FilterByFunctionButton.tsx +1 -1
  54. package/src/ProfileView/ViewSelector.tsx +2 -2
  55. package/src/ProfileView/VisualizationPanel.tsx +1 -1
  56. package/src/ProfileView/index.tsx +6 -2
  57. package/src/ProfileViewWithData.tsx +4 -2
  58. package/src/TopTable/index.tsx +1 -1
  59. package/src/components/DiffLegend.tsx +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.16.144](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.143...@parca/profile@0.16.144) (2023-03-21)
7
+
8
+ # 0.16.0 (2023-03-01)
9
+
10
+ **Note:** Version bump only for package @parca/profile
11
+
12
+ ## [0.16.143](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.142...@parca/profile@0.16.143) (2023-03-21)
13
+
14
+ **Note:** Version bump only for package @parca/profile
15
+
6
16
  ## [0.16.142](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.141...@parca/profile@0.16.142) (2023-03-21)
7
17
 
8
18
  **Note:** Version bump only for package @parca/profile
@@ -28,8 +28,8 @@ import * as d3 from 'd3';
28
28
  import SVG from 'react-inlinesvg';
29
29
  import { MapInteractionCSS } from 'react-map-interaction';
30
30
  import { Button, useKeyDown, useURLState } from '@parca/components';
31
- import { getNewSpanColor } from '@parca/functions';
32
31
  import { selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector } from '@parca/store';
32
+ import { getNewSpanColor } from '@parca/utilities';
33
33
  import GraphTooltip from '../GraphTooltip';
34
34
  var Callgraph = function (_a) {
35
35
  var data = _a.data, svgString = _a.svgString, sampleUnit = _a.sampleUnit, width = _a.width;
@@ -38,8 +38,8 @@ import { pointer } from 'd3-selection';
38
38
  import { CopyToClipboard } from 'react-copy-to-clipboard';
39
39
  import { usePopper } from 'react-popper';
40
40
  import { useKeyDown } from '@parca/components';
41
- import { getLastItem, valueFormatter } from '@parca/functions';
42
41
  import { selectHoveringNode, useAppSelector } from '@parca/store';
42
+ import { getLastItem, valueFormatter } from '@parca/utilities';
43
43
  import { hexifyAddress, truncateString, truncateStringReverse } from '../';
44
44
  import { ExpandOnHover } from './ExpandOnHoverValue';
45
45
  var NoData = function () {
@@ -26,8 +26,8 @@ import { useEffect, useMemo, useRef, useState } from 'react';
26
26
  import cx from 'classnames';
27
27
  import TextareaAutosize from 'react-textarea-autosize';
28
28
  import { useGrpcMetadata } from '@parca/components';
29
- import { sanitizeLabelValue } from '@parca/functions';
30
29
  import { Query } from '@parca/parser';
30
+ import { sanitizeLabelValue } from '@parca/utilities';
31
31
  import SuggestionsList, { Suggestion, Suggestions } from './SuggestionsList';
32
32
  export var useLabelNames = function (client) {
33
33
  var _a = useState(true), loading = _a[0], setLoading = _a[1];
@@ -36,7 +36,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
36
36
  import { useEffect, useState } from 'react';
37
37
  import { usePopper } from 'react-popper';
38
38
  import { TextWithTooltip } from '@parca/components';
39
- import { formatDate, valueFormatter } from '@parca/functions';
39
+ import { formatDate, valueFormatter } from '@parca/utilities';
40
40
  import { timeFormat } from '../../';
41
41
  var virtualElement = {
42
42
  getBoundingClientRect: function () {
@@ -27,8 +27,8 @@ import * as d3 from 'd3';
27
27
  import { pointer } from 'd3-selection';
28
28
  import throttle from 'lodash.throttle';
29
29
  import { DateTimeRange, useKeyDown } from '@parca/components';
30
- import { useContainerDimensions } from '@parca/dynamicsize';
31
- import { formatDate, formatForTimespan, sanitizeHighlightedValues, valueFormatter, } from '@parca/functions';
30
+ import { useContainerDimensions } from '@parca/hooks';
31
+ import { formatDate, formatForTimespan, sanitizeHighlightedValues, valueFormatter, } from '@parca/utilities';
32
32
  import MetricsCircle from '../MetricsCircle';
33
33
  import MetricsSeries from '../MetricsSeries';
34
34
  import MetricsTooltip from './MetricsTooltip';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { QueryServiceClient } from '@parca/client';
3
- import type { NavigateFunction } from '@parca/functions';
3
+ import type { NavigateFunction } from '@parca/utilities';
4
4
  import { ProfileSelection } from '..';
5
5
  import { QuerySelection } from '../ProfileSelector';
6
6
  interface ProfileExplorerCompareProps {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { QueryServiceClient } from '@parca/client';
3
- import type { NavigateFunction } from '@parca/functions';
3
+ import type { NavigateFunction } from '@parca/utilities';
4
4
  import { ProfileSelection } from '..';
5
5
  import { QuerySelection } from '../ProfileSelector';
6
6
  interface ProfileExplorerSingleProps {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { QueryServiceClient } from '@parca/client';
3
- import type { NavigateFunction } from '@parca/functions';
3
+ import type { NavigateFunction } from '@parca/utilities';
4
4
  interface ProfileExplorerProps {
5
5
  queryClient: QueryServiceClient;
6
6
  queryParams: any;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { NavigateFunction } from '@parca/functions';
2
+ import type { NavigateFunction } from '@parca/utilities';
3
3
  interface Props {
4
4
  navigateTo?: NavigateFunction;
5
5
  compareMode?: boolean;
@@ -26,7 +26,7 @@ import { useMemo } from 'react';
26
26
  import { Icon } from '@iconify/react';
27
27
  import cx from 'classnames';
28
28
  import { useURLState } from '@parca/components';
29
- import useUserPreference, { USER_PREFERENCES } from '@parca/functions/useUserPreference';
29
+ import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
30
30
  import { EVERYTHING_ELSE, selectStackColors, useAppSelector } from '@parca/store';
31
31
  var ColorStackLegend = function (_a) {
32
32
  var navigateTo = _a.navigateTo, _b = _a.compareMode, compareMode = _b === void 0 ? false : _b;
@@ -26,8 +26,8 @@ import React, { useMemo } from 'react';
26
26
  import cx from 'classnames';
27
27
  import { scaleLinear } from 'd3-scale';
28
28
  import { useKeyDown } from '@parca/components';
29
- import { isSearchMatch } from '@parca/functions';
30
29
  import { selectBinaries, setHoveringNode, useAppDispatch, useAppSelector } from '@parca/store';
30
+ import { isSearchMatch } from '@parca/utilities';
31
31
  import useNodeColor from './useNodeColor';
32
32
  import { nodeLabel } from './utils';
33
33
  export var RowHeight = 26;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Flamegraph } from '@parca/client';
3
- import { type NavigateFunction } from '@parca/functions';
3
+ import { type NavigateFunction } from '@parca/utilities';
4
4
  interface IcicleGraphProps {
5
5
  graph: Flamegraph;
6
6
  sampleUnit: string;
@@ -24,8 +24,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
24
24
  // limitations under the License.
25
25
  import { memo, useEffect, useMemo, useRef, useState } from 'react';
26
26
  import { scaleLinear } from 'd3-scale';
27
- import { selectQueryParam } from '@parca/functions';
28
27
  import { setHoveringNode, useAppDispatch } from '@parca/store';
28
+ import { selectQueryParam } from '@parca/utilities';
29
29
  import GraphTooltip from '../../GraphTooltip';
30
30
  import ColorStackLegend from './ColorStackLegend';
31
31
  import { IcicleNode, RowHeight } from './IcicleGraphNodes';
@@ -22,7 +22,7 @@ var __assign = (this && this.__assign) || function () {
22
22
  return __assign.apply(this, arguments);
23
23
  };
24
24
  import { useEffect, useMemo } from 'react';
25
- import useUserPreference, { USER_PREFERENCES } from '@parca/functions/useUserPreference';
25
+ import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
26
26
  import { selectDarkMode, setFeatures, useAppDispatch, useAppSelector, } from '@parca/store';
27
27
  import { extractFeature } from './utils';
28
28
  var colorNodes = function (nodes, strings, mappings, locations, functions, features) {
@@ -11,8 +11,8 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { useMemo } from 'react';
14
- import { COLOR_PROFILES, diffColor } from '@parca/functions';
15
14
  import { EVERYTHING_ELSE, selectDarkMode, selectStackColors, useAppSelector } from '@parca/store';
15
+ import { COLOR_PROFILES, diffColor } from '@parca/utilities';
16
16
  var useNodeColor = function (_a) {
17
17
  var data = _a.data, compareMode = _a.compareMode;
18
18
  var colors = useAppSelector(selectStackColors);
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { getLastItem } from '@parca/functions';
14
13
  import { EVERYTHING_ELSE, FEATURE_TYPES } from '@parca/store';
14
+ import { getLastItem } from '@parca/utilities';
15
15
  import { hexifyAddress } from '../../utils';
16
16
  export var getBinaryName = function (node, mappings, locations, strings) {
17
17
  var _a, _b;
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { Flamegraph } from '@parca/client';
3
- import { type NavigateFunction } from '@parca/functions';
3
+ import { type NavigateFunction } from '@parca/utilities';
4
4
  export type ResizeHandler = (width: number, height: number) => void;
5
5
  interface ProfileIcicleGraphProps {
6
6
  width?: number;
7
7
  graph: Flamegraph | undefined;
8
+ total: bigint;
9
+ filtered: bigint;
8
10
  sampleUnit: string;
9
11
  curPath: string[] | [];
10
12
  setNewCurPath: (path: string[]) => void;
@@ -13,5 +15,5 @@ interface ProfileIcicleGraphProps {
13
15
  loading: boolean;
14
16
  setActionButtons?: (buttons: JSX.Element) => void;
15
17
  }
16
- declare const ProfileIcicleGraph: ({ graph, curPath, setNewCurPath, sampleUnit, onContainerResize, navigateTo, loading, setActionButtons, }: ProfileIcicleGraphProps) => JSX.Element;
18
+ declare const ProfileIcicleGraph: ({ graph, total, filtered, curPath, setNewCurPath, sampleUnit, onContainerResize, navigateTo, loading, setActionButtons, }: ProfileIcicleGraphProps) => JSX.Element;
17
19
  export default ProfileIcicleGraph;
@@ -24,13 +24,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
24
24
  // limitations under the License.
25
25
  import { useEffect, useMemo } from 'react';
26
26
  import { Button } from '@parca/components';
27
- import { useContainerDimensions } from '@parca/dynamicsize';
28
- import { selectQueryParam } from '@parca/functions';
27
+ import { useContainerDimensions } from '@parca/hooks';
28
+ import { selectQueryParam } from '@parca/utilities';
29
29
  import DiffLegend from '../components/DiffLegend';
30
30
  import { IcicleGraph } from './IcicleGraph';
31
31
  var numberFormatter = new Intl.NumberFormat('en-US');
32
32
  var ProfileIcicleGraph = function (_a) {
33
- var graph = _a.graph, curPath = _a.curPath, setNewCurPath = _a.setNewCurPath, sampleUnit = _a.sampleUnit, onContainerResize = _a.onContainerResize, navigateTo = _a.navigateTo, loading = _a.loading, setActionButtons = _a.setActionButtons;
33
+ var graph = _a.graph, total = _a.total, filtered = _a.filtered, curPath = _a.curPath, setNewCurPath = _a.setNewCurPath, sampleUnit = _a.sampleUnit, onContainerResize = _a.onContainerResize, navigateTo = _a.navigateTo, loading = _a.loading, setActionButtons = _a.setActionButtons;
34
34
  var compareMode = selectQueryParam('compare_a') === 'true' && selectQueryParam('compare_b') === 'true';
35
35
  var _b = useContainerDimensions(), ref = _b.ref, dimensions = _b.dimensions;
36
36
  useEffect(function () {
@@ -41,21 +41,24 @@ var ProfileIcicleGraph = function (_a) {
41
41
  onContainerResize(dimensions.width, dimensions.height);
42
42
  }, [dimensions, onContainerResize]);
43
43
  var _c = useMemo(function () {
44
- if (graph === undefined || graph.untrimmedTotal === '0') {
45
- return [false, BigInt(0), '0'];
44
+ if (graph === undefined) {
45
+ return ['0', '0', false, '0', '0', false, '0', '0'];
46
46
  }
47
- var untrimmedTotal = BigInt(graph.untrimmedTotal);
48
- var total = BigInt(graph.total);
49
- var trimDifference = untrimmedTotal - total;
50
- var trimmedPercentage = (total * BigInt(100)) / untrimmedTotal;
47
+ var trimmed = BigInt(graph.trimmed);
48
+ var rawTotal = total + filtered + trimmed;
49
+ // safeguard against division by zero
50
+ var rawTotalDivisor = rawTotal > 0 ? rawTotal : BigInt(1);
51
51
  return [
52
- trimDifference > BigInt(0),
53
- trimDifference,
54
- trimmedPercentage.toString(),
55
52
  numberFormatter.format(total),
56
- numberFormatter.format(untrimmedTotal),
53
+ numberFormatter.format(rawTotal),
54
+ trimmed > 0,
55
+ numberFormatter.format(trimmed),
56
+ numberFormatter.format((trimmed * BigInt(100)) / rawTotalDivisor),
57
+ filtered > 0,
58
+ numberFormatter.format(filtered),
59
+ numberFormatter.format((filtered * BigInt(100)) / rawTotalDivisor),
57
60
  ];
58
- }, [graph]), isTrimmed = _c[0], _ = _c[1], trimmedPercentage = _c[2], formattedTotal = _c[3], formattedUntrimmedTotal = _c[4];
61
+ }, [filtered, graph, total]), totalFormatted = _c[0], rawFormatted = _c[1], isTrimmed = _c[2], trimmedFormatted = _c[3], trimmedPercentage = _c[4], isFiltered = _c[5], filteredFormatted = _c[6], filteredPercentage = _c[7];
59
62
  useEffect(function () {
60
63
  if (setActionButtons === undefined) {
61
64
  return;
@@ -64,9 +67,8 @@ var ProfileIcicleGraph = function (_a) {
64
67
  }, [setNewCurPath, curPath, setActionButtons]);
65
68
  if (graph === undefined)
66
69
  return _jsx("div", { children: "no data..." });
67
- var total = graph.total;
68
- if (parseFloat(total) === 0 && !loading)
70
+ if (total === BigInt(0) && !loading)
69
71
  return _jsx(_Fragment, { children: "Profile has no samples" });
70
- return (_jsxs("div", __assign({ className: "relative" }, { children: [compareMode && _jsx(DiffLegend, {}), isTrimmed ? (_jsxs("p", __assign({ className: "my-2 text-sm" }, { children: ["Showing ", formattedTotal, "(", trimmedPercentage, "%) out of ", formattedUntrimmedTotal, " samples"] }))) : null, _jsx("div", __assign({ ref: ref }, { children: _jsx(IcicleGraph, { width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, graph: graph, curPath: curPath, setCurPath: setNewCurPath, sampleUnit: sampleUnit, navigateTo: navigateTo }) }))] })));
72
+ return (_jsxs("div", __assign({ className: "relative" }, { children: [compareMode && _jsx(DiffLegend, {}), _jsx("div", __assign({ ref: ref }, { children: _jsx(IcicleGraph, { width: dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, graph: graph, curPath: curPath, setCurPath: setNewCurPath, sampleUnit: sampleUnit, navigateTo: navigateTo }) })), _jsxs("p", __assign({ className: "my-2 text-xs" }, { children: ["Showing ", totalFormatted, " ", isFiltered || isTrimmed ? _jsxs("span", { children: ["of ", rawFormatted, " "] }) : _jsx(_Fragment, {}), "samples.", ' ', isFiltered ? (_jsxs("span", { children: ["Filtered ", filteredFormatted, " (", filteredPercentage, "%) samples.\u00A0"] })) : (_jsx(_Fragment, {})), isTrimmed ? (_jsxs("span", { children: ["Trimmed ", trimmedFormatted, " (", trimmedPercentage, "%) too small samples."] })) : (_jsx(_Fragment, {}))] }))] })));
71
73
  };
72
74
  export default ProfileIcicleGraph;
@@ -61,8 +61,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
61
61
  import { useEffect, useState } from 'react';
62
62
  import { Duration, Timestamp } from '@parca/client';
63
63
  import { useGrpcMetadata, useParcaContext } from '@parca/components';
64
- import { getStepDuration } from '@parca/functions';
65
64
  import { Query } from '@parca/parser';
65
+ import { getStepDuration } from '@parca/utilities';
66
66
  import MetricsGraph from '../MetricsGraph';
67
67
  import useDelayedLoader from '../useDelayedLoader';
68
68
  export var useQueryRange = function (client, queryExpression, start, end) {
@@ -24,9 +24,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
24
24
  // limitations under the License.
25
25
  import { useEffect, useState } from 'react';
26
26
  import { Button, ButtonGroup, Card, DateTimeRange, DateTimeRangePicker, useGrpcMetadata, } from '@parca/components';
27
- import { getStepDuration, getStepDurationInMilliseconds } from '@parca/functions';
28
27
  import { CloseIcon } from '@parca/icons';
29
28
  import { Query } from '@parca/parser';
29
+ import { getStepDuration, getStepDurationInMilliseconds } from '@parca/utilities';
30
30
  import { MergedProfileSelection } from '..';
31
31
  import MatchersInput from '../MatchersInput/index';
32
32
  import ProfileMetricsGraph from '../ProfileMetricsGraph';
@@ -12,8 +12,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { ProfileDiffSelection_Mode, QueryRequest_Mode, QueryRequest_ReportType, Timestamp, } from '@parca/client';
15
- import { formatDate } from '@parca/functions';
16
15
  import { ProfileType, Query } from '@parca/parser';
16
+ import { formatDate } from '@parca/utilities';
17
17
  export var timeFormat = "MMM d, 'at' h:mm:s a '(UTC)'";
18
18
  export var timeFormatShort = 'MMM d, h:mma';
19
19
  export function ParamsString(params) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { NavigateFunction } from '@parca/functions';
2
+ import type { NavigateFunction } from '@parca/utilities';
3
3
  declare const FilterByFunctionButton: ({ navigateTo, }: {
4
4
  navigateTo: NavigateFunction | undefined;
5
5
  }) => JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { NavigateFunction } from '@parca/functions';
2
+ import type { NavigateFunction } from '@parca/utilities';
3
3
  interface Props {
4
4
  position: number;
5
5
  defaultValue: string;
@@ -23,7 +23,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
23
23
  // See the License for the specific language governing permissions and
24
24
  // limitations under the License.
25
25
  import { Select, useURLState } from '@parca/components';
26
- import useUIFeatureFlag from '@parca/functions/useUIFeatureFlag';
26
+ import { useUIFeatureFlag } from '@parca/hooks';
27
27
  var ViewSelector = function (_a) {
28
28
  var defaultValue = _a.defaultValue, navigateTo = _a.navigateTo, position = _a.position, placeholderText = _a.placeholderText, _b = _a.primary, primary = _b === void 0 ? false : _b, _c = _a.addView, addView = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d;
29
29
  var callgraphEnabled = useUIFeatureFlag('callgraph')[0];
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { DraggableProvidedDragHandleProps } from 'react-beautiful-dnd';
3
- import type { NavigateFunction } from '@parca/functions';
3
+ import type { NavigateFunction } from '@parca/utilities';
4
4
  interface Props {
5
5
  dashboardItem: string;
6
6
  index: number;
@@ -8,6 +8,8 @@ type NavigateFunction = (path: string, queryParams: any, options?: {
8
8
  export interface FlamegraphData {
9
9
  loading: boolean;
10
10
  data?: Flamegraph;
11
+ total?: bigint;
12
+ filtered?: bigint;
11
13
  error?: any;
12
14
  }
13
15
  export interface TopTableData {
@@ -74,9 +74,9 @@ import { scaleLinear } from 'd3';
74
74
  import graphviz from 'graphviz-wasm';
75
75
  import { DragDropContext, Draggable, Droppable, } from 'react-beautiful-dnd';
76
76
  import { Button, Card, ConditionalWrapper, KeyDownProvider, useParcaContext, useURLState, } from '@parca/components';
77
- import { useContainerDimensions } from '@parca/dynamicsize';
78
- import { getNewSpanColor } from '@parca/functions';
77
+ import { useContainerDimensions } from '@parca/hooks';
79
78
  import { selectDarkMode, useAppSelector } from '@parca/store';
79
+ import { getNewSpanColor } from '@parca/utilities';
80
80
  import { Callgraph } from '../';
81
81
  import { jsonToDot } from '../Callgraph/utils';
82
82
  import ProfileIcicleGraph from '../ProfileIcicleGraph';
@@ -202,13 +202,14 @@ export var ProfileView = function (_a) {
202
202
  }
203
203
  };
204
204
  var getDashboardItemByType = function (_a) {
205
+ var _b, _c;
205
206
  var type = _a.type, isHalfScreen = _a.isHalfScreen, setActionButtons = _a.setActionButtons;
206
207
  switch (type) {
207
208
  case 'icicle': {
208
209
  return (flamegraphData === null || flamegraphData === void 0 ? void 0 : flamegraphData.data) != null ? (_jsx(ConditionalWrapper, __assign({ condition: (perf === null || perf === void 0 ? void 0 : perf.onRender) != null, WrapperComponent: Profiler, wrapperProps: {
209
210
  id: 'icicleGraph',
210
211
  onRender: perf === null || perf === void 0 ? void 0 : perf.onRender,
211
- } }, { children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, graph: flamegraphData.data, sampleUnit: sampleUnit, onContainerResize: onFlamegraphContainerResize, navigateTo: navigateTo, loading: flamegraphData.loading, setActionButtons: setActionButtons }) }))) : (_jsx(_Fragment, { children: " " }));
212
+ } }, { children: _jsx(ProfileIcicleGraph, { curPath: curPath, setNewCurPath: setNewCurPath, graph: flamegraphData.data, total: (_b = flamegraphData === null || flamegraphData === void 0 ? void 0 : flamegraphData.total) !== null && _b !== void 0 ? _b : BigInt(0), filtered: (_c = flamegraphData === null || flamegraphData === void 0 ? void 0 : flamegraphData.filtered) !== null && _c !== void 0 ? _c : BigInt(0), sampleUnit: sampleUnit, onContainerResize: onFlamegraphContainerResize, navigateTo: navigateTo, loading: flamegraphData.loading, setActionButtons: setActionButtons }) }))) : (_jsx(_Fragment, { children: " " }));
212
213
  }
213
214
  case 'callgraph': {
214
215
  return (callgraphData === null || callgraphData === void 0 ? void 0 : callgraphData.data) !== undefined &&
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { QueryServiceClient } from '@parca/client';
3
- import { type NavigateFunction } from '@parca/functions';
3
+ import { type NavigateFunction } from '@parca/utilities';
4
4
  import { ProfileSource } from './ProfileSource';
5
5
  interface ProfileViewWithDataProps {
6
6
  queryClient: QueryServiceClient;
@@ -50,17 +50,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
50
50
  import { useEffect, useState } from 'react';
51
51
  import { QueryRequest_ReportType } from '@parca/client';
52
52
  import { useGrpcMetadata, useParcaContext, useURLState } from '@parca/components';
53
- import { saveAsBlob } from '@parca/functions';
54
- import useUserPreference, { USER_PREFERENCES } from '@parca/functions/useUserPreference';
53
+ import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
54
+ import { saveAsBlob } from '@parca/utilities';
55
55
  import { ProfileView } from './ProfileView';
56
56
  import { useQuery } from './useQuery';
57
57
  import { downloadPprof } from './utils';
58
58
  export var ProfileViewWithData = function (_a) {
59
- var _b, _c;
59
+ var _b, _c, _d, _e;
60
60
  var queryClient = _a.queryClient, profileSource = _a.profileSource, navigateTo = _a.navigateTo;
61
61
  var metadata = useGrpcMetadata();
62
62
  var dashboardItems = useURLState({ param: 'dashboard_items', navigateTo: navigateTo })[0];
63
- var _d = useState(0), nodeTrimThreshold = _d[0], setNodeTrimThreshold = _d[1];
63
+ var _f = useState(0), nodeTrimThreshold = _f[0], setNodeTrimThreshold = _f[1];
64
64
  var enableTrimming = useUserPreference(USER_PREFERENCES.ENABLE_GRAPH_TRIMMING.key)[0];
65
65
  useEffect(function () {
66
66
  if (!enableTrimming) {
@@ -77,17 +77,17 @@ export var ProfileViewWithData = function (_a) {
77
77
  }
78
78
  setNodeTrimThreshold(threshold);
79
79
  };
80
- var _e = useQuery(queryClient, profileSource, QueryRequest_ReportType.FLAMEGRAPH_TABLE, {
80
+ var _g = useQuery(queryClient, profileSource, QueryRequest_ReportType.FLAMEGRAPH_TABLE, {
81
81
  skip: !dashboardItems.includes('icicle'),
82
82
  nodeTrimThreshold: nodeTrimThreshold,
83
- }), flamegraphLoading = _e.isLoading, flamegraphResponse = _e.response, flamegraphError = _e.error;
83
+ }), flamegraphLoading = _g.isLoading, flamegraphResponse = _g.response, flamegraphError = _g.error;
84
84
  var perf = useParcaContext().perf;
85
- var _f = useQuery(queryClient, profileSource, QueryRequest_ReportType.TOP, {
85
+ var _h = useQuery(queryClient, profileSource, QueryRequest_ReportType.TOP, {
86
86
  skip: !dashboardItems.includes('table'),
87
- }), topTableLoading = _f.isLoading, topTableResponse = _f.response, topTableError = _f.error;
88
- var _g = useQuery(queryClient, profileSource, QueryRequest_ReportType.CALLGRAPH, {
87
+ }), topTableLoading = _h.isLoading, topTableResponse = _h.response, topTableError = _h.error;
88
+ var _j = useQuery(queryClient, profileSource, QueryRequest_ReportType.CALLGRAPH, {
89
89
  skip: !dashboardItems.includes('callgraph'),
90
- }), callgraphLoading = _g.isLoading, callgraphResponse = _g.response, callgraphError = _g.error;
90
+ }), callgraphLoading = _j.isLoading, callgraphResponse = _j.response, callgraphError = _j.error;
91
91
  useEffect(function () {
92
92
  var _a, _b;
93
93
  if (!flamegraphLoading && (flamegraphResponse === null || flamegraphResponse === void 0 ? void 0 : flamegraphResponse.report.oneofKind) === 'flamegraph') {
@@ -138,6 +138,8 @@ export var ProfileViewWithData = function (_a) {
138
138
  data: (flamegraphResponse === null || flamegraphResponse === void 0 ? void 0 : flamegraphResponse.report.oneofKind) === 'flamegraph'
139
139
  ? (_b = flamegraphResponse === null || flamegraphResponse === void 0 ? void 0 : flamegraphResponse.report) === null || _b === void 0 ? void 0 : _b.flamegraph
140
140
  : undefined,
141
+ total: BigInt((_c = flamegraphResponse === null || flamegraphResponse === void 0 ? void 0 : flamegraphResponse.total) !== null && _c !== void 0 ? _c : '0'),
142
+ filtered: BigInt((_d = flamegraphResponse === null || flamegraphResponse === void 0 ? void 0 : flamegraphResponse.filtered) !== null && _d !== void 0 ? _d : '0'),
141
143
  error: flamegraphError,
142
144
  }, topTableData: {
143
145
  loading: topTableLoading,
@@ -146,7 +148,7 @@ export var ProfileViewWithData = function (_a) {
146
148
  }, callgraphData: {
147
149
  loading: callgraphLoading,
148
150
  data: (callgraphResponse === null || callgraphResponse === void 0 ? void 0 : callgraphResponse.report.oneofKind) === 'callgraph'
149
- ? (_c = callgraphResponse === null || callgraphResponse === void 0 ? void 0 : callgraphResponse.report) === null || _c === void 0 ? void 0 : _c.callgraph
151
+ ? (_e = callgraphResponse === null || callgraphResponse === void 0 ? void 0 : callgraphResponse.report) === null || _e === void 0 ? void 0 : _e.callgraph
150
152
  : undefined,
151
153
  error: callgraphError,
152
154
  }, sampleUnit: sampleUnit, profileSource: profileSource, queryClient: queryClient, navigateTo: navigateTo, onDownloadPProf: function () { return void downloadPProfClick(); }, onFlamegraphContainerResize: onFlamegraphContainerResize }));
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Top, TopNodeMeta } from '@parca/client';
3
- import { type NavigateFunction } from '@parca/functions';
3
+ import { type NavigateFunction } from '@parca/utilities';
4
4
  interface TopTableProps {
5
5
  loading: boolean;
6
6
  data?: Top;
@@ -25,7 +25,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
25
25
  import React, { useCallback, useEffect, useMemo } from 'react';
26
26
  import { createColumnHelper } from '@tanstack/react-table';
27
27
  import { Button, Table, useURLState } from '@parca/components';
28
- import { getLastItem, isSearchMatch, parseParams, valueFormatter, } from '@parca/functions';
28
+ import { getLastItem, isSearchMatch, parseParams, valueFormatter, } from '@parca/utilities';
29
29
  import { hexifyAddress } from '../utils';
30
30
  export var RowLabel = function (meta) {
31
31
  var _a, _b, _c, _d, _e, _f;
@@ -25,8 +25,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  import { Fragment, useState } from 'react';
26
26
  import { Popover, Transition } from '@headlessui/react';
27
27
  import { usePopper } from 'react-popper';
28
- import { getIncreasedSpanColor, getNewSpanColor, getReducedSpanColor } from '@parca/functions';
29
28
  import { selectDarkMode, useAppSelector } from '@parca/store';
29
+ import { getIncreasedSpanColor, getNewSpanColor, getReducedSpanColor } from '@parca/utilities';
30
30
  var transparencyValues = [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100];
31
31
  var DiffLegendBar = function (_a) {
32
32
  var onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave;
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.142",
3
+ "version": "0.16.144",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
- "@parca/client": "^0.16.67",
7
- "@parca/components": "^0.16.116",
6
+ "@parca/client": "^0.16.68",
7
+ "@parca/components": "^0.16.118",
8
8
  "@parca/dynamicsize": "^0.16.54",
9
- "@parca/functions": "^0.16.68",
9
+ "@parca/functions": "^0.16.69",
10
+ "@parca/hooks": "^0.0.2",
10
11
  "@parca/parser": "^0.16.55",
11
- "@parca/store": "^0.16.66",
12
+ "@parca/store": "^0.16.68",
13
+ "@parca/utilities": "^0.0.2",
12
14
  "@types/react-beautiful-dnd": "^13.1.3",
13
15
  "d3": "7.8.2",
14
16
  "d3-scale": "^4.0.2",
@@ -45,5 +47,5 @@
45
47
  "access": "public",
46
48
  "registry": "https://registry.npmjs.org/"
47
49
  },
48
- "gitHead": "a1e44da90997207f78785fa433d9f6e5a9d2eac3"
50
+ "gitHead": "12ac7e9f6767020015df495897092340d4a8bb81"
49
51
  }
@@ -20,8 +20,8 @@ import {MapInteractionCSS} from 'react-map-interaction';
20
20
 
21
21
  import {CallgraphEdge, Callgraph as CallgraphType} from '@parca/client';
22
22
  import {Button, useKeyDown, useURLState} from '@parca/components';
23
- import {getNewSpanColor} from '@parca/functions';
24
23
  import {selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector} from '@parca/store';
24
+ import {getNewSpanColor} from '@parca/utilities';
25
25
 
26
26
  import GraphTooltip from '../GraphTooltip';
27
27
 
@@ -30,8 +30,8 @@ import {
30
30
  Function as ParcaFunction,
31
31
  } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
32
32
  import {useKeyDown} from '@parca/components';
33
- import {getLastItem, valueFormatter} from '@parca/functions';
34
33
  import {selectHoveringNode, useAppSelector} from '@parca/store';
34
+ import {getLastItem, valueFormatter} from '@parca/utilities';
35
35
 
36
36
  import {hexifyAddress, truncateString, truncateStringReverse} from '../';
37
37
  import {ExpandOnHover} from './ExpandOnHoverValue';
@@ -18,8 +18,8 @@ import TextareaAutosize from 'react-textarea-autosize';
18
18
 
19
19
  import {LabelsResponse, QueryServiceClient} from '@parca/client';
20
20
  import {useGrpcMetadata} from '@parca/components';
21
- import {sanitizeLabelValue} from '@parca/functions';
22
21
  import {Query} from '@parca/parser';
22
+ import {sanitizeLabelValue} from '@parca/utilities';
23
23
 
24
24
  import SuggestionsList, {Suggestion, Suggestions} from './SuggestionsList';
25
25
 
@@ -18,7 +18,7 @@ import {usePopper} from 'react-popper';
18
18
 
19
19
  import {Label} from '@parca/client';
20
20
  import {TextWithTooltip} from '@parca/components';
21
- import {formatDate, valueFormatter} from '@parca/functions';
21
+ import {formatDate, valueFormatter} from '@parca/utilities';
22
22
 
23
23
  import {HighlightedSeries} from '../';
24
24
  import {timeFormat} from '../../';
@@ -19,13 +19,13 @@ import throttle from 'lodash.throttle';
19
19
 
20
20
  import {Label, MetricsSample, MetricsSeries as MetricsSeriesPb} from '@parca/client';
21
21
  import {DateTimeRange, useKeyDown} from '@parca/components';
22
- import {useContainerDimensions} from '@parca/dynamicsize';
22
+ import {useContainerDimensions} from '@parca/hooks';
23
23
  import {
24
24
  formatDate,
25
25
  formatForTimespan,
26
26
  sanitizeHighlightedValues,
27
27
  valueFormatter,
28
- } from '@parca/functions';
28
+ } from '@parca/utilities';
29
29
 
30
30
  import {MergedProfileSelection} from '..';
31
31
  import MetricsCircle from '../MetricsCircle';
@@ -12,8 +12,8 @@
12
12
  // limitations under the License.
13
13
 
14
14
  import {QueryServiceClient} from '@parca/client';
15
- import type {NavigateFunction} from '@parca/functions';
16
15
  import {Query} from '@parca/parser';
16
+ import type {NavigateFunction} from '@parca/utilities';
17
17
 
18
18
  import {ProfileDiffSource, ProfileSelection, ProfileViewWithData} from '..';
19
19
  import ProfileSelector, {QuerySelection} from '../ProfileSelector';
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
 
14
14
  import {QueryServiceClient} from '@parca/client';
15
- import type {NavigateFunction} from '@parca/functions';
15
+ import type {NavigateFunction} from '@parca/utilities';
16
16
 
17
17
  import {ProfileSelection, ProfileViewWithData} from '..';
18
18
  import ProfileSelector, {QuerySelection} from '../ProfileSelector';
@@ -17,8 +17,8 @@ import {Provider} from 'react-redux';
17
17
 
18
18
  import {QueryServiceClient} from '@parca/client';
19
19
  import {DateTimeRange, KeyDownProvider, useParcaContext} from '@parca/components';
20
- import type {NavigateFunction} from '@parca/functions';
21
20
  import {store} from '@parca/store';
21
+ import type {NavigateFunction} from '@parca/utilities';
22
22
 
23
23
  import {ProfileSelection, ProfileSelectionFromParams, SuffixParams} from '..';
24
24
  import {QuerySelection, useProfileTypes} from '../ProfileSelector';
@@ -17,9 +17,9 @@ import {Icon} from '@iconify/react';
17
17
  import cx from 'classnames';
18
18
 
19
19
  import {useURLState} from '@parca/components';
20
- import type {NavigateFunction} from '@parca/functions';
21
- import useUserPreference, {USER_PREFERENCES} from '@parca/functions/useUserPreference';
20
+ import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
22
21
  import {EVERYTHING_ELSE, selectStackColors, useAppSelector} from '@parca/store';
22
+ import type {NavigateFunction} from '@parca/utilities';
23
23
 
24
24
  interface Props {
25
25
  navigateTo?: NavigateFunction;
@@ -23,8 +23,8 @@ import {
23
23
  Function as ParcaFunction,
24
24
  } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
25
25
  import {useKeyDown} from '@parca/components';
26
- import {isSearchMatch} from '@parca/functions';
27
26
  import {selectBinaries, setHoveringNode, useAppDispatch, useAppSelector} from '@parca/store';
27
+ import {isSearchMatch} from '@parca/utilities';
28
28
 
29
29
  import useNodeColor from './useNodeColor';
30
30
  import {nodeLabel} from './utils';
@@ -16,8 +16,8 @@ import {memo, useEffect, useMemo, useRef, useState} from 'react';
16
16
  import {scaleLinear} from 'd3-scale';
17
17
 
18
18
  import {Flamegraph} from '@parca/client';
19
- import {selectQueryParam, type NavigateFunction} from '@parca/functions';
20
19
  import {setHoveringNode, useAppDispatch} from '@parca/store';
20
+ import {selectQueryParam, type NavigateFunction} from '@parca/utilities';
21
21
 
22
22
  import GraphTooltip from '../../GraphTooltip';
23
23
  import ColorStackLegend from './ColorStackLegend';
@@ -19,8 +19,7 @@ import {
19
19
  Mapping,
20
20
  Function as ParcaFunction,
21
21
  } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
22
- import type {ColorProfileName} from '@parca/functions';
23
- import useUserPreference, {USER_PREFERENCES} from '@parca/functions/useUserPreference';
22
+ import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
24
23
  import {
25
24
  selectDarkMode,
26
25
  setFeatures,
@@ -29,6 +28,7 @@ import {
29
28
  type FeatureType,
30
29
  type FeaturesMap,
31
30
  } from '@parca/store';
31
+ import type {ColorProfileName} from '@parca/utilities';
32
32
 
33
33
  import {extractFeature} from './utils';
34
34
 
@@ -13,8 +13,8 @@
13
13
 
14
14
  import {useMemo} from 'react';
15
15
 
16
- import {COLOR_PROFILES, diffColor} from '@parca/functions';
17
16
  import {EVERYTHING_ELSE, selectDarkMode, selectStackColors, useAppSelector} from '@parca/store';
17
+ import {COLOR_PROFILES, diffColor} from '@parca/utilities';
18
18
 
19
19
  import type {ColoredFlamegraphNode} from './useColoredGraph';
20
20
 
@@ -17,8 +17,8 @@ import {
17
17
  Mapping,
18
18
  Function as ParcaFunction,
19
19
  } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
20
- import {getLastItem} from '@parca/functions';
21
20
  import {EVERYTHING_ELSE, FEATURE_TYPES, type Feature} from '@parca/store';
21
+ import {getLastItem} from '@parca/utilities';
22
22
 
23
23
  import {hexifyAddress} from '../../utils';
24
24
 
@@ -15,8 +15,8 @@ import {useEffect, useMemo} from 'react';
15
15
 
16
16
  import {Flamegraph} from '@parca/client';
17
17
  import {Button} from '@parca/components';
18
- import {useContainerDimensions} from '@parca/dynamicsize';
19
- import {selectQueryParam, type NavigateFunction} from '@parca/functions';
18
+ import {useContainerDimensions} from '@parca/hooks';
19
+ import {selectQueryParam, type NavigateFunction} from '@parca/utilities';
20
20
 
21
21
  import DiffLegend from '../components/DiffLegend';
22
22
  import {IcicleGraph} from './IcicleGraph';
@@ -28,6 +28,8 @@ export type ResizeHandler = (width: number, height: number) => void;
28
28
  interface ProfileIcicleGraphProps {
29
29
  width?: number;
30
30
  graph: Flamegraph | undefined;
31
+ total: bigint;
32
+ filtered: bigint;
31
33
  sampleUnit: string;
32
34
  curPath: string[] | [];
33
35
  setNewCurPath: (path: string[]) => void;
@@ -39,6 +41,8 @@ interface ProfileIcicleGraphProps {
39
41
 
40
42
  const ProfileIcicleGraph = ({
41
43
  graph,
44
+ total,
45
+ filtered,
42
46
  curPath,
43
47
  setNewCurPath,
44
48
  sampleUnit,
@@ -58,25 +62,38 @@ const ProfileIcicleGraph = ({
58
62
  onContainerResize(dimensions.width, dimensions.height);
59
63
  }, [dimensions, onContainerResize]);
60
64
 
61
- const [isTrimmed, _, trimmedPercentage, formattedTotal, formattedUntrimmedTotal] = useMemo(() => {
62
- if (graph === undefined || graph.untrimmedTotal === '0') {
63
- return [false, BigInt(0), '0'];
65
+ const [
66
+ totalFormatted,
67
+ rawFormatted,
68
+ isTrimmed,
69
+ trimmedFormatted,
70
+ trimmedPercentage,
71
+ isFiltered,
72
+ filteredFormatted,
73
+ filteredPercentage,
74
+ ] = useMemo(() => {
75
+ if (graph === undefined) {
76
+ return ['0', '0', false, '0', '0', false, '0', '0'];
64
77
  }
65
78
 
66
- const untrimmedTotal = BigInt(graph.untrimmedTotal);
67
- const total = BigInt(graph.total);
79
+ const trimmed = BigInt(graph.trimmed);
68
80
 
69
- const trimDifference = untrimmedTotal - total;
70
- const trimmedPercentage = (total * BigInt(100)) / untrimmedTotal;
81
+ const rawTotal = total + filtered + trimmed;
82
+
83
+ // safeguard against division by zero
84
+ const rawTotalDivisor = rawTotal > 0 ? rawTotal : BigInt(1);
71
85
 
72
86
  return [
73
- trimDifference > BigInt(0),
74
- trimDifference,
75
- trimmedPercentage.toString(),
76
87
  numberFormatter.format(total),
77
- numberFormatter.format(untrimmedTotal),
88
+ numberFormatter.format(rawTotal),
89
+ trimmed > 0,
90
+ numberFormatter.format(trimmed),
91
+ numberFormatter.format((trimmed * BigInt(100)) / rawTotalDivisor),
92
+ filtered > 0,
93
+ numberFormatter.format(filtered),
94
+ numberFormatter.format((filtered * BigInt(100)) / rawTotalDivisor),
78
95
  ];
79
- }, [graph]);
96
+ }, [filtered, graph, total]);
80
97
 
81
98
  useEffect(() => {
82
99
  if (setActionButtons === undefined) {
@@ -99,18 +116,11 @@ const ProfileIcicleGraph = ({
99
116
 
100
117
  if (graph === undefined) return <div>no data...</div>;
101
118
 
102
- const total = graph.total;
103
-
104
- if (parseFloat(total) === 0 && !loading) return <>Profile has no samples</>;
119
+ if (total === BigInt(0) && !loading) return <>Profile has no samples</>;
105
120
 
106
121
  return (
107
122
  <div className="relative">
108
123
  {compareMode && <DiffLegend />}
109
- {isTrimmed ? (
110
- <p className="my-2 text-sm">
111
- Showing {formattedTotal}({trimmedPercentage}%) out of {formattedUntrimmedTotal} samples
112
- </p>
113
- ) : null}
114
124
  <div ref={ref}>
115
125
  <IcicleGraph
116
126
  width={dimensions?.width}
@@ -121,6 +131,24 @@ const ProfileIcicleGraph = ({
121
131
  navigateTo={navigateTo}
122
132
  />
123
133
  </div>
134
+ <p className="my-2 text-xs">
135
+ Showing {totalFormatted} {isFiltered || isTrimmed ? <span>of {rawFormatted} </span> : <></>}
136
+ samples.{' '}
137
+ {isFiltered ? (
138
+ <span>
139
+ Filtered {filteredFormatted} ({filteredPercentage}%) samples.&nbsp;
140
+ </span>
141
+ ) : (
142
+ <></>
143
+ )}
144
+ {isTrimmed ? (
145
+ <span>
146
+ Trimmed {trimmedFormatted} ({trimmedPercentage}%) too small samples.
147
+ </span>
148
+ ) : (
149
+ <></>
150
+ )}
151
+ </p>
124
152
  </div>
125
153
  );
126
154
  };
@@ -17,8 +17,8 @@ import {RpcError} from '@protobuf-ts/runtime-rpc';
17
17
 
18
18
  import {Duration, Label, QueryRangeResponse, QueryServiceClient, Timestamp} from '@parca/client';
19
19
  import {DateTimeRange, useGrpcMetadata, useParcaContext} from '@parca/components';
20
- import {getStepDuration} from '@parca/functions';
21
20
  import {Query} from '@parca/parser';
21
+ import {getStepDuration} from '@parca/utilities';
22
22
 
23
23
  import {MergedProfileSelection, ProfileSelection} from '..';
24
24
  import MetricsGraph from '../MetricsGraph';
@@ -24,9 +24,9 @@ import {
24
24
  DateTimeRangePicker,
25
25
  useGrpcMetadata,
26
26
  } from '@parca/components';
27
- import {getStepDuration, getStepDurationInMilliseconds} from '@parca/functions';
28
27
  import {CloseIcon} from '@parca/icons';
29
28
  import {Query} from '@parca/parser';
29
+ import {getStepDuration, getStepDurationInMilliseconds} from '@parca/utilities';
30
30
 
31
31
  import {MergedProfileSelection, ProfileSelection} from '..';
32
32
  import MatchersInput from '../MatchersInput/index';
@@ -20,8 +20,8 @@ import {
20
20
  QueryRequest_ReportType,
21
21
  Timestamp,
22
22
  } from '@parca/client';
23
- import {formatDate} from '@parca/functions';
24
23
  import {Matcher, ProfileType, Query} from '@parca/parser';
24
+ import {formatDate} from '@parca/utilities';
25
25
 
26
26
  export interface ProfileSource {
27
27
  QueryRequest: () => QueryRequest;
@@ -16,7 +16,7 @@ import {useCallback, useMemo, useState} from 'react';
16
16
  import {Icon} from '@iconify/react';
17
17
 
18
18
  import {Input, useURLState} from '@parca/components';
19
- import type {NavigateFunction} from '@parca/functions';
19
+ import type {NavigateFunction} from '@parca/utilities';
20
20
 
21
21
  const FilterByFunctionButton = ({
22
22
  navigateTo,
@@ -12,8 +12,8 @@
12
12
  // limitations under the License.
13
13
 
14
14
  import {Select, useURLState, type SelectElement} from '@parca/components';
15
- import type {NavigateFunction} from '@parca/functions';
16
- import useUIFeatureFlag from '@parca/functions/useUIFeatureFlag';
15
+ import {useUIFeatureFlag} from '@parca/hooks';
16
+ import type {NavigateFunction} from '@parca/utilities';
17
17
 
18
18
  interface Props {
19
19
  position: number;
@@ -17,8 +17,8 @@ import {Icon} from '@iconify/react';
17
17
  import cx from 'classnames';
18
18
  import type {DraggableProvidedDragHandleProps} from 'react-beautiful-dnd';
19
19
 
20
- import type {NavigateFunction} from '@parca/functions';
21
20
  import {CloseIcon} from '@parca/icons';
21
+ import type {NavigateFunction} from '@parca/utilities';
22
22
 
23
23
  import ViewSelector from './ViewSelector';
24
24
 
@@ -33,9 +33,9 @@ import {
33
33
  useParcaContext,
34
34
  useURLState,
35
35
  } from '@parca/components';
36
- import {useContainerDimensions} from '@parca/dynamicsize';
37
- import {getNewSpanColor} from '@parca/functions';
36
+ import {useContainerDimensions} from '@parca/hooks';
38
37
  import {selectDarkMode, useAppSelector} from '@parca/store';
38
+ import {getNewSpanColor} from '@parca/utilities';
39
39
 
40
40
  import {Callgraph} from '../';
41
41
  import {jsonToDot} from '../Callgraph/utils';
@@ -53,6 +53,8 @@ type NavigateFunction = (path: string, queryParams: any, options?: {replace?: bo
53
53
  export interface FlamegraphData {
54
54
  loading: boolean;
55
55
  data?: Flamegraph;
56
+ total?: bigint;
57
+ filtered?: bigint;
56
58
  error?: any;
57
59
  }
58
60
 
@@ -233,6 +235,8 @@ export const ProfileView = ({
233
235
  curPath={curPath}
234
236
  setNewCurPath={setNewCurPath}
235
237
  graph={flamegraphData.data}
238
+ total={flamegraphData?.total ?? BigInt(0)}
239
+ filtered={flamegraphData?.filtered ?? BigInt(0)}
236
240
  sampleUnit={sampleUnit}
237
241
  onContainerResize={onFlamegraphContainerResize}
238
242
  navigateTo={navigateTo}
@@ -15,8 +15,8 @@ import {useEffect, useState} from 'react';
15
15
 
16
16
  import {QueryRequest_ReportType, QueryServiceClient} from '@parca/client';
17
17
  import {useGrpcMetadata, useParcaContext, useURLState} from '@parca/components';
18
- import {saveAsBlob, type NavigateFunction} from '@parca/functions';
19
- import useUserPreference, {USER_PREFERENCES} from '@parca/functions/useUserPreference';
18
+ import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
19
+ import {saveAsBlob, type NavigateFunction} from '@parca/utilities';
20
20
 
21
21
  import {ProfileSource} from './ProfileSource';
22
22
  import {ProfileView} from './ProfileView';
@@ -128,6 +128,8 @@ export const ProfileViewWithData = ({
128
128
  flamegraphResponse?.report.oneofKind === 'flamegraph'
129
129
  ? flamegraphResponse?.report?.flamegraph
130
130
  : undefined,
131
+ total: BigInt(flamegraphResponse?.total ?? '0'),
132
+ filtered: BigInt(flamegraphResponse?.filtered ?? '0'),
131
133
  error: flamegraphError,
132
134
  }}
133
135
  topTableData={{
@@ -23,7 +23,7 @@ import {
23
23
  parseParams,
24
24
  valueFormatter,
25
25
  type NavigateFunction,
26
- } from '@parca/functions';
26
+ } from '@parca/utilities';
27
27
 
28
28
  import {hexifyAddress} from '../utils';
29
29
 
@@ -16,8 +16,8 @@ import {Fragment, useState} from 'react';
16
16
  import {Popover, Transition} from '@headlessui/react';
17
17
  import {usePopper} from 'react-popper';
18
18
 
19
- import {getIncreasedSpanColor, getNewSpanColor, getReducedSpanColor} from '@parca/functions';
20
19
  import {selectDarkMode, useAppSelector} from '@parca/store';
20
+ import {getIncreasedSpanColor, getNewSpanColor, getReducedSpanColor} from '@parca/utilities';
21
21
 
22
22
  const transparencyValues = [-100, -80, -60, -40, -20, 0, 20, 40, 60, 80, 100];
23
23