@parca/profile 0.16.469 → 0.16.471

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 (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.d.ts.map +1 -1
  3. package/dist/GraphTooltipArrow/Content.js +5 -3
  4. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts +1 -0
  5. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +3 -1
  7. package/dist/MetricsGraph/UtilizationMetrics/index.d.ts.map +1 -1
  8. package/dist/MetricsGraph/UtilizationMetrics/index.js +3 -0
  9. package/dist/MetricsGraphStrips/AreaGraph/Tooltip.d.ts +1 -1
  10. package/dist/MetricsGraphStrips/AreaGraph/Tooltip.d.ts.map +1 -1
  11. package/dist/MetricsGraphStrips/AreaGraph/index.js +1 -1
  12. package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts +1 -0
  13. package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts.map +1 -1
  14. package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.js +1 -0
  15. package/dist/MetricsGraphStrips/index.d.ts +2 -1
  16. package/dist/MetricsGraphStrips/index.d.ts.map +1 -1
  17. package/dist/MetricsGraphStrips/index.js +3 -13
  18. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.d.ts.map +1 -1
  19. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.js +8 -10
  20. package/dist/ProfileSelector/MetricsGraphSection.js +1 -1
  21. package/dist/ProfileSource.d.ts +1 -0
  22. package/dist/ProfileSource.d.ts.map +1 -1
  23. package/dist/ProfileSource.js +1 -1
  24. package/package.json +6 -6
  25. package/src/GraphTooltipArrow/Content.tsx +16 -3
  26. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +4 -0
  27. package/src/MetricsGraph/UtilizationMetrics/index.tsx +4 -0
  28. package/src/MetricsGraphStrips/AreaGraph/Tooltip.tsx +1 -1
  29. package/src/MetricsGraphStrips/AreaGraph/index.tsx +1 -1
  30. package/src/MetricsGraphStrips/MetricsGraphStrips.stories.tsx +1 -0
  31. package/src/MetricsGraphStrips/index.tsx +4 -13
  32. package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.tsx +9 -15
  33. package/src/ProfileSelector/MetricsGraphSection.tsx +1 -1
  34. package/src/ProfileSource.tsx +2 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.471](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.470...@parca/profile@0.16.471) (2025-02-13)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## 0.16.470 (2025-02-12)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.16.469](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.468...@parca/profile@0.16.469) (2025-02-10)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -1 +1 @@
1
- {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../src/GraphTooltipArrow/Content.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAQ1C,UAAU,6BAA6B;IACrC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAMD,QAAA,MAAM,wBAAwB,gGAU3B,6BAA6B,KAAG,KAAK,CAAC,GAAG,CAAC,OAgF5C,CAAC;AA2EF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../src/GraphTooltipArrow/Content.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAQ1C,UAAU,6BAA6B;IACrC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAMD,QAAA,MAAM,wBAAwB,gGAU3B,6BAA6B,KAAG,KAAK,CAAC,GAAG,CAAC,OAgF5C,CAAC;AAuFF,eAAe,wBAAwB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Icon } from '@iconify/react';
3
- import { getLastItem } from '@parca/utilities';
3
+ import { useParcaContext } from '@parca/components';
4
+ import { formatDateTimeDownToMS, getLastItem } from '@parca/utilities';
4
5
  import { hexifyAddress, truncateString, truncateStringReverse } from '../utils';
5
6
  import { ExpandOnHover } from './ExpandOnHoverValue';
6
7
  import { useGraphTooltip } from './useGraphTooltip';
@@ -30,10 +31,11 @@ const GraphTooltipArrowContent = ({ table, profileType, unit, total, totalUnfilt
30
31
  : 'unknown' })) }), _jsx("table", { className: "my-2 w-full table-fixed pr-0 text-gray-700 dark:text-gray-300", children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Cumulative" }), _jsx("td", { className: "w-3/4", children: _jsx("div", { children: cumulativeText }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pt-2", children: "Flat" }), _jsx("td", { className: "w-3/4 pt-2", children: _jsx("div", { children: flatText }) })] }), diff !== 0n && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pt-2", children: "Diff" }), _jsx("td", { className: "w-3/4 pt-2", children: _jsx("div", { children: diffText }) })] })), _jsx(TooltipMetaInfo, { table: table, row: rowNumber })] }) })] }) }), _jsxs("div", { className: "flex w-full items-center gap-1 text-xs text-gray-500", children: [_jsx(Icon, { icon: "iconoir:mouse-button-right" }), _jsx("div", { children: "Right click to show context menu" })] })] }) }) }));
31
32
  };
32
33
  const TooltipMetaInfo = ({ table, row }) => {
33
- const { labelPairs, functionFilename, file, locationAddress, mappingFile, mappingBuildID, inlined, } = useGraphTooltipMetaInfo({ table, row });
34
+ const { labelPairs, functionFilename, file, locationAddress, mappingFile, mappingBuildID, inlined, timestamp, } = useGraphTooltipMetaInfo({ table, row });
35
+ const { timezone } = useParcaContext();
34
36
  const labels = labelPairs.map((l) => (_jsx("span", { className: "mr-3 inline-block rounded-lg bg-gray-200 px-2 py-1 text-xs font-bold text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: `${l[0]}="${l[1]}"` }, l[0])));
35
37
  const isMappingBuildIDAvailable = mappingBuildID !== null && mappingBuildID !== '';
36
38
  const inlinedText = inlined === null ? 'merged' : inlined ? 'yes' : 'no';
37
- return (_jsxs(_Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pt-2", children: "File" }), _jsx("td", { className: "w-3/4 pt-2 break-all", children: functionFilename === '' ? (_jsx(NoData, {})) : (_jsx("div", { className: "flex gap-4", children: _jsx("div", { className: "whitespace-nowrap text-left", children: _jsx(ExpandOnHover, { value: file, displayValue: truncateStringReverse(file, 30) }) }) })) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Address" }), _jsx("td", { className: "w-3/4 break-all", children: locationAddress === 0n ? _jsx(NoData, {}) : _jsx("div", { children: hexifyAddress(locationAddress) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Inlined" }), _jsx("td", { className: "w-3/4 break-all", children: inlinedText })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Binary" }), _jsx("td", { className: "w-3/4 break-all", children: (mappingFile != null ? getLastItem(mappingFile) : null) ?? _jsx(NoData, {}) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Build Id" }), _jsx("td", { className: "w-3/4 break-all", children: isMappingBuildIDAvailable ? _jsx("div", { children: truncateString(mappingBuildID, 28) }) : _jsx(NoData, {}) })] }), labelPairs.length > 0 && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Labels" }), _jsx("td", { className: "w-3/4 break-all", children: labels })] }))] }));
39
+ return (_jsxs(_Fragment, { children: [timestamp == null || timestamp === 0n ? (_jsx("div", { className: "pt-2" })) : (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4 pt-2", children: "Timestamp" }), _jsx("td", { className: "w-3/4 pt-2 break-all", children: formatDateTimeDownToMS(new Date(Number(timestamp / 1000000n)), timezone) }), ' '] })), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "File" }), _jsx("td", { className: "w-3/4 break-all", children: functionFilename === '' ? (_jsx(NoData, {})) : (_jsx("div", { className: "flex gap-4", children: _jsx("div", { className: "whitespace-nowrap text-left", children: _jsx(ExpandOnHover, { value: file, displayValue: truncateStringReverse(file, 30) }) }) })) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Address" }), _jsx("td", { className: "w-3/4 break-all", children: locationAddress === 0n ? _jsx(NoData, {}) : _jsx("div", { children: hexifyAddress(locationAddress) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Inlined" }), _jsx("td", { className: "w-3/4 break-all", children: inlinedText })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Binary" }), _jsx("td", { className: "w-3/4 break-all", children: (mappingFile != null ? getLastItem(mappingFile) : null) ?? _jsx(NoData, {}) })] }), _jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Build Id" }), _jsx("td", { className: "w-3/4 break-all", children: isMappingBuildIDAvailable ? _jsx("div", { children: truncateString(mappingBuildID, 28) }) : _jsx(NoData, {}) })] }), labelPairs.length > 0 && (_jsxs("tr", { children: [_jsx("td", { className: "w-1/4", children: "Labels" }), _jsx("td", { className: "w-3/4 break-all", children: labels })] }))] }));
38
40
  };
39
41
  export default GraphTooltipArrowContent;
@@ -14,6 +14,7 @@ interface GraphTooltipMetaInfoData {
14
14
  mappingFile: string | null;
15
15
  mappingBuildID: string | null;
16
16
  inlined: boolean | null;
17
+ timestamp: bigint | null;
17
18
  }
18
19
  export declare const useGraphTooltipMetaInfo: ({ table, row }: Props) => GraphTooltipMetaInfoData;
19
20
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAoBnC,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,uBAAuB,mBAAkB,KAAK,KAAG,wBA4F7D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAqBnC,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,mBAAkB,KAAK,KAAG,wBA8F7D,CAAC"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { QueryRequest_ReportType } from '@parca/client';
14
14
  import { useParcaContext, useURLState } from '@parca/components';
15
- import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_START_LINE, FIELD_FUNCTION_SYSTEM_NAME, FIELD_INLINED, FIELD_LOCATION_ADDRESS, FIELD_LOCATION_LINE, FIELD_MAPPING_BUILD_ID, FIELD_MAPPING_FILE, } from '../../ProfileIcicleGraph/IcicleGraphArrow';
15
+ import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_START_LINE, FIELD_FUNCTION_SYSTEM_NAME, FIELD_INLINED, FIELD_LOCATION_ADDRESS, FIELD_LOCATION_LINE, FIELD_MAPPING_BUILD_ID, FIELD_MAPPING_FILE, FIELD_TIMESTAMP, } from '../../ProfileIcicleGraph/IcicleGraphArrow';
16
16
  import { arrowToString } from '../../ProfileIcicleGraph/IcicleGraphArrow/utils';
17
17
  import { useProfileViewContext } from '../../ProfileView/context/ProfileViewContext';
18
18
  import { useQuery } from '../../useQuery';
@@ -28,6 +28,7 @@ export const useGraphTooltipMetaInfo = ({ table, row }) => {
28
28
  const lineNumber = locationLine !== 0n ? locationLine : functionStartLine !== 0n ? functionStartLine : undefined;
29
29
  const labelPrefix = 'labels.';
30
30
  const labelColumnNames = table.schema.fields.filter(field => field.name.startsWith(labelPrefix));
31
+ const timestamp = table.getChild(FIELD_TIMESTAMP)?.get(row);
31
32
  const { queryServiceClient, enableSourcesView } = useParcaContext();
32
33
  const { profileSource } = useProfileViewContext();
33
34
  const { isLoading: sourceLoading, response: sourceResponse } = useQuery(queryServiceClient, profileSource, QueryRequest_ReportType.SOURCE, {
@@ -84,5 +85,6 @@ export const useGraphTooltipMetaInfo = ({ table, row }) => {
84
85
  mappingBuildID,
85
86
  mappingFile,
86
87
  inlined,
88
+ timestamp,
87
89
  };
88
90
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/UtilizationMetrics/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,aAAa,EAAwC,MAAM,mBAAmB,CAAC;AAUvF,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MA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EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoaD,QAAA,MAAM,kBAAkB,wEAKrB,KAAK,KAAG,GAAG,CAAC,OA4Bd,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -114,6 +114,9 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
114
114
  const color = d3.scaleOrdinal(d3.schemeCategory10);
115
115
  const l = d3.line(d => xScale(d[0]), d => yScale(d[1]));
116
116
  const highlighted = useMemo(() => {
117
+ if (series.length === 0) {
118
+ return null;
119
+ }
117
120
  // Return the closest point as the highlighted point
118
121
  const closestPointPerSeries = series.map(function (s) {
119
122
  const distances = s.values.map(d => {
@@ -1,7 +1,7 @@
1
1
  interface TooltipProps {
2
2
  x: number;
3
3
  y: number;
4
- timestamp: Date;
4
+ timestamp: Date | number;
5
5
  value: number;
6
6
  containerWidth: number;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraphStrips/AreaGraph/Tooltip.tsx"],"names":[],"mappings":"AAkBA,UAAU,YAAY;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,OAAO,CAAC,EAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAwD3F"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraphStrips/AreaGraph/Tooltip.tsx"],"names":[],"mappings":"AAkBA,UAAU,YAAY;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,OAAO,CAAC,EAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAwD3F"}
@@ -192,5 +192,5 @@ export const AreaGraph = ({ data, height, width, marginLeft = 0, marginRight = 0
192
192
  hoverData !== null &&
193
193
  !isDragging &&
194
194
  !isHoveringDragHandle &&
195
- isMouseOverGraph && (_jsx(Tooltip, { x: mousePosition[0], y: mousePosition[1], timestamp: new Date(hoverData.timestamp), value: hoverData.value, containerWidth: width })), _jsx("svg", { style: { width: '100%', height: '100%' }, children: _jsx("path", { fill: fill, d: area(data), className: "opacity-80" }) })] }));
195
+ isMouseOverGraph && (_jsx(Tooltip, { x: mousePosition[0], y: mousePosition[1], timestamp: hoverData.timestamp, value: hoverData.value, containerWidth: width })), _jsx("svg", { style: { width: '100%', height: '100%' }, children: _jsx("path", { fill: fill, d: area(data), className: "opacity-80" }) })] }));
196
196
  };
@@ -17,6 +17,7 @@ export declare const ThreeCPUStrips: {
17
17
  bounds: number[];
18
18
  };
19
19
  onSelectedTimeframe: (index: number, bounds: NumberDuo) => void;
20
+ bounds: number[];
20
21
  };
21
22
  render: (args: any) => JSX.Element;
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MetricsGraphStrips.stories.d.ts","sourceRoot":"","sources":["../../src/MetricsGraphStrips/MetricsGraphStrips.stories.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAqBtC,QAAA,MAAM,IAAI,EAAE,IAGX,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,cAAc;;;;;;;;;;;;;qCAKM,MAAM,UAAU,SAAS,KAAG,IAAI;;mBAI9B,GAAG,KAAG,GAAG,CAAC,OAAO;CAUnD,CAAC"}
1
+ {"version":3,"file":"MetricsGraphStrips.stories.d.ts","sourceRoot":"","sources":["../../src/MetricsGraphStrips/MetricsGraphStrips.stories.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAqBtC,QAAA,MAAM,IAAI,EAAE,IAGX,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,cAAc;;;;;;;;;;;;;qCAKM,MAAM,UAAU,SAAS,KAAG,IAAI;;;mBAK9B,GAAG,KAAG,GAAG,CAAC,OAAO;CAUnD,CAAC"}
@@ -43,6 +43,7 @@ export const ThreeCPUStrips = {
43
43
  onSelectedTimeframe: (index, bounds) => {
44
44
  console.log('onSelectedTimeframe', index, bounds);
45
45
  },
46
+ bounds: [mockData[0][0].timestamp, mockData[0][mockData[0].length - 1].timestamp],
46
47
  },
47
48
  render: function Component(args) {
48
49
  const [, setArgs] = useArgs();
@@ -10,8 +10,9 @@ interface Props {
10
10
  };
11
11
  onSelectedTimeframe: (labels: LabelSet, bounds: NumberDuo | undefined) => void;
12
12
  width?: number;
13
+ bounds: NumberDuo;
13
14
  }
14
15
  export declare const labelSetToString: (labelSet?: LabelSet) => string;
15
- export declare const MetricsGraphStrips: ({ cpus, data, selectedTimeframe, onSelectedTimeframe, width, }: Props) => JSX.Element;
16
+ export declare const MetricsGraphStrips: ({ cpus, data, selectedTimeframe, onSelectedTimeframe, width, bounds, }: Props) => JSX.Element;
16
17
  export {};
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsGraphStrips/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAY,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE;QAClB,MAAM,EAAE,QAAQ,CAAC;QACjB,MAAM,EAAE,SAAS,CAAC;KACnB,CAAC;IACF,mBAAmB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAmBtD,CAAC;AAMF,eAAO,MAAM,kBAAkB,mEAM5B,KAAK,KAAG,GAAG,CAAC,OAmEd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsGraphStrips/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAY,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE;QAClB,MAAM,EAAE,QAAQ,CAAC;QACjB,MAAM,EAAE,SAAS,CAAC;KACnB,CAAC;IACF,mBAAmB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,gBAAgB,cAAe,QAAQ,KAAG,MAmBtD,CAAC;AAMF,eAAO,MAAM,kBAAkB,2EAO5B,KAAK,KAAG,GAAG,CAAC,OAwDd,CAAC"}
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { useMemo, useState } from 'react';
14
+ import { useState } from 'react';
15
15
  import { Icon } from '@iconify/react';
16
16
  import * as d3 from 'd3';
17
17
  import isEqual from 'fast-deep-equal';
@@ -36,21 +36,11 @@ export const labelSetToString = (labelSet) => {
36
36
  const getTimelineGuideHeight = (cpus, collapsedIndices) => {
37
37
  return 56 * (cpus.length - collapsedIndices.length) + 20 * collapsedIndices.length + 24;
38
38
  };
39
- export const MetricsGraphStrips = ({ cpus, data, selectedTimeframe, onSelectedTimeframe, width, }) => {
39
+ export const MetricsGraphStrips = ({ cpus, data, selectedTimeframe, onSelectedTimeframe, width, bounds, }) => {
40
40
  const [collapsedIndices, setCollapsedIndices] = useState([]);
41
41
  // @ts-expect-error
42
42
  const color = d3.scaleOrdinal(d3.schemeObservable10);
43
- const bounds = useMemo(() => {
44
- const bounds = data.length > 0 ? [Infinity, -Infinity] : [0, 1];
45
- data.forEach(cpuData => {
46
- cpuData.forEach(dataPoint => {
47
- bounds[0] = Math.min(bounds[0], dataPoint.timestamp);
48
- bounds[1] = Math.max(bounds[1], dataPoint.timestamp);
49
- });
50
- });
51
- return [0, bounds[1] - bounds[0]];
52
- }, [data]);
53
- return (_jsxs("div", { className: "flex flex-col gap-1 relative my-0 ml-[70px]", style: { width: width ?? '100%' }, children: [_jsx(TimelineGuide, { bounds: [BigInt(bounds[0]), BigInt(bounds[1])], width: width ?? 1468, height: getTimelineGuideHeight(cpus, collapsedIndices), margin: 1 }), cpus.map((cpu, i) => {
43
+ return (_jsxs("div", { className: "flex flex-col gap-1 relative my-0 ml-[70px]", style: { width: width ?? '100%' }, children: [_jsx(TimelineGuide, { bounds: [BigInt(0), BigInt(bounds[1] - bounds[0])], width: width ?? 1468, height: getTimelineGuideHeight(cpus, collapsedIndices), margin: 1 }), cpus.map((cpu, i) => {
54
44
  const isCollapsed = collapsedIndices.includes(i);
55
45
  const labelStr = labelSetToString(cpu);
56
46
  return (_jsxs("div", { className: "relative min-h-5", style: { width: width ?? 1468 }, children: [_jsxs("div", { className: "text-xs absolute top-0 left-0 flex gap-[2px] items-center bg-white/50 px-1 rounded-sm cursor-pointer", style: {
@@ -1 +1 @@
1
- {"version":3,"file":"IcicleChartRootNode.d.ts","sourceRoot":"","sources":["../../../src/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAa,eAAe,EAAY,MAAM,oBAAoB,CAAC;AAG1E,UAAU,gCAAgC;IACxC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,gFA8H9B,CAAC"}
1
+ {"version":3,"file":"IcicleChartRootNode.d.ts","sourceRoot":"","sources":["../../../src/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAa,eAAe,EAAY,MAAM,oBAAoB,CAAC;AAG1E,UAAU,gCAAgC;IACxC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,gFAyH9B,CAAC"}
@@ -15,13 +15,14 @@ import React from 'react';
15
15
  import cx from 'classnames';
16
16
  import twColors from 'tailwindcss/colors';
17
17
  import { scaleLinear } from '@parca/utilities';
18
- import { FIELD_CHILDREN, FIELD_CUMULATIVE, FIELD_GROUPBY_METADATA } from '.';
18
+ import { FIELD_CHILDREN, FIELD_CUMULATIVE, FIELD_DURATION, FIELD_TIMESTAMP } from '.';
19
19
  import { IcicleNode, RowHeight } from './IcicleGraphNodes';
20
- import { arrowToString, boundsFromProfileSource } from './utils';
20
+ import { boundsFromProfileSource } from './utils';
21
21
  export const IcicleChartRootNode = React.memo(function IcicleChartRootNodeNonMemo({ table, row, colors, colorBy, y, height, setCurPath, curPath, level, path, total, totalWidth, xScale, searchString, setHoveringRow, setHoveringLevel, sortBy, darkMode, compareMode, profileType, isContextMenuOpen, hoveringName, setHoveringName, hoveringRow, colorForSimilarNodes, highlightSimilarStacksPreference, profileSource, }) {
22
22
  // get the columns to read from
23
+ const durationColumn = table.getChild(FIELD_DURATION);
24
+ const timestampColumn = table.getChild(FIELD_TIMESTAMP);
23
25
  const cumulativeColumn = table.getChild(FIELD_CUMULATIVE);
24
- const groupByMetadata = table.getChild(FIELD_GROUPBY_METADATA);
25
26
  const cumulative = cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
26
27
  const childRows = Array.from(table.getChild(FIELD_CHILDREN)?.get(row) ?? []).sort((a, b) => a - b);
27
28
  const tsBounds = boundsFromProfileSource(profileSource);
@@ -35,13 +36,10 @@ export const IcicleChartRootNode = React.memo(function IcicleChartRootNodeNonMem
35
36
  return _jsx(_Fragment, { children: null });
36
37
  }
37
38
  return (_jsx(_Fragment, { children: childRows.map(row => {
38
- const groupByFields = (groupByMetadata?.get(row)).toJSON();
39
- const tsStr = arrowToString(groupByFields.time_nanos);
40
- const tsNanos = BigInt(parseInt(tsStr, 10));
41
- const durationStr = arrowToString(groupByFields.duration);
42
- const duration = parseInt(durationStr, 10);
43
- const x = tsXScale(tsNanos);
44
- const width = tsXScale(tsNanos + BigInt(Math.round(duration))) - x;
39
+ const duration = durationColumn?.get(row) !== null ? BigInt(durationColumn?.get(row)) : 0n;
40
+ const timestamp = timestampColumn?.get(row) !== null ? BigInt(timestampColumn?.get(row)) : 0n;
41
+ const x = tsXScale(timestamp);
42
+ const width = tsXScale(timestamp + BigInt(Math.round(Number(duration)))) - x;
45
43
  const cumulative = cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
46
44
  const newXScale = scaleLinear([0n, BigInt(cumulative)], [0, width]);
47
45
  return (_jsxs(_Fragment, { children: [_jsxs("g", { transform: `translate(${x + 1}, ${y + 1})`, children: [_jsx("rect", { x: 0, y: 0, width: width, height: RowHeight, style: {
@@ -75,7 +75,7 @@ export function MetricsGraphSection({ showMetricsGraph, setDisplayHideMetricsGra
75
75
  const mergeTo = query.profileType().delta ? mergeFrom + durationInMilliseconds : mergeFrom;
76
76
  selectProfile(new MergedProfileSelection(mergeFrom, mergeTo, query));
77
77
  };
78
- return (_jsxs("div", { className: cx('relative', { 'py-4': !showMetricsGraph }), children: [_jsxs("button", { onClick: () => setDisplayHideMetricsGraphButton(!showMetricsGraph), className: cx('hidden z-10 px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900', showMetricsGraph && 'absolute right-0 bottom-3 !flex', !showMetricsGraph && 'relative !flex ml-auto'), children: [showMetricsGraph ? 'Hide' : 'Show', " Metrics Graph"] }), showMetricsGraph && (_jsx(_Fragment, { children: _jsx("div", { style: { height: heightStyle }, children: querySelection.expression !== '' &&
78
+ return (_jsxs("div", { className: cx('relative', { 'py-4': !showMetricsGraph }), children: [_jsxs("button", { onClick: () => setDisplayHideMetricsGraphButton(!showMetricsGraph), className: cx('hidden px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900', showMetricsGraph && 'absolute right-0 bottom-3 !flex', !showMetricsGraph && 'relative !flex ml-auto'), children: [showMetricsGraph ? 'Hide' : 'Show', " Metrics Graph"] }), showMetricsGraph && (_jsx(_Fragment, { children: _jsx("div", { style: { height: heightStyle }, children: querySelection.expression !== '' &&
79
79
  querySelection.from !== undefined &&
80
80
  querySelection.to !== undefined ? (_jsx(_Fragment, { children: utilizationMetrics !== undefined ? (_jsx(UtilizationMetricsGraph, { data: utilizationMetrics, addLabelMatcher: addLabelMatcher, setTimeRange: handleTimeRangeChange, utilizationMetricsLoading: utilizationMetricsLoading })) : (_jsx(_Fragment, { children: _jsx(ProfileMetricsGraph, { queryClient: queryClient, queryExpression: querySelection.expression, from: querySelection.from, to: querySelection.to, profile: profileSelection, comparing: comparing, sumBy: querySelection.sumBy ?? sumBy ?? [], sumByLoading: defaultSumByLoading, setTimeRange: handleTimeRangeChange, addLabelMatcher: addLabelMatcher, onPointClick: handlePointClick }) })) })) : (profileSelection === null && (_jsx("div", { className: "p-2", children: _jsx(ProfileMetricsEmptyState, { message: "Please select a profile type and click 'Search' to begin." }) }))) }) }))] }));
81
81
  }
@@ -14,6 +14,7 @@ export interface ProfileSelection {
14
14
  ProfileSource: () => ProfileSource;
15
15
  Type: () => string;
16
16
  }
17
+ export declare const timeFormat: (timezone?: string) => string;
17
18
  export declare function ParamsString(params: {
18
19
  [key: string]: string;
19
20
  }): string;
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileSource.d.ts","sourceRoot":"","sources":["../src/ProfileSource.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,oBAAoB,EAEpB,YAAY,EAIb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAqB,WAAW,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAGrE,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,YAAY,CAAC;IACjC,WAAW,EAAE,MAAM,WAAW,CAAC;IAC/B,aAAa,EAAE,MAAM,oBAAoB,C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AAW,IAAI,MAAM;IAIrB,aAAa,IAAI;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAQrC,IAAI,IAAI,MAAM;IAId,aAAa,IAAI,aAAa;CAG/B;AAED,qBAAa,iBAAkB,YAAW,aAAa;IACrD,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAEP,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO;IAQxF,aAAa,IAAI,oBAAoB;IAIrC,YAAY,IAAI,YAAY;IAiB5B,WAAW,IAAI,WAAW;IAI1B,QAAQ,IAAI,GAAG,CAAC,OAAO;IAQvB,QAAQ,IAAI,MAAM;CAUnB;AAED,qBAAa,mBAAoB,YAAW,aAAa;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,WAAW,CAAC;gBAEb,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM;IAQlF,aAAa,IAAI,oBAAoB;IAcrC,YAAY,IAAI,YAAY;IAiB5B,WAAW,IAAI,WAAW;IAI1B,cAAc,IAAI,MAAM,EAAE;IAM1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;CAmBpC"}
@@ -14,7 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { ProfileDiffSelection_Mode, QueryRequest_Mode, QueryRequest_ReportType, Timestamp, } from '@parca/client';
15
15
  import { NewParser, ProfileType, Query } from '@parca/parser';
16
16
  import { formatDate, formatDuration } from '@parca/utilities';
17
- const timeFormat = (timezone) => {
17
+ export const timeFormat = (timezone) => {
18
18
  if (timezone !== undefined) {
19
19
  return 'yyyy-MM-dd HH:mm:ss';
20
20
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.469",
3
+ "version": "0.16.471",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@headlessui/react": "^1.7.19",
7
7
  "@iconify/react": "^4.0.0",
8
8
  "@parca/client": "0.16.127",
9
- "@parca/components": "0.16.320",
9
+ "@parca/components": "0.16.322",
10
10
  "@parca/dynamicsize": "0.16.65",
11
- "@parca/hooks": "0.0.78",
11
+ "@parca/hooks": "0.0.80",
12
12
  "@parca/icons": "0.16.71",
13
13
  "@parca/parser": "0.16.78",
14
- "@parca/store": "0.16.164",
15
- "@parca/utilities": "0.0.90",
14
+ "@parca/store": "0.16.166",
15
+ "@parca/utilities": "0.0.92",
16
16
  "@popperjs/core": "^2.11.8",
17
17
  "@protobuf-ts/runtime-rpc": "^2.5.0",
18
18
  "@storybook/preview-api": "^8.4.3",
@@ -75,5 +75,5 @@
75
75
  "access": "public",
76
76
  "registry": "https://registry.npmjs.org/"
77
77
  },
78
- "gitHead": "9c58fab5ba798535fbba3607549a568bdebe9606"
78
+ "gitHead": "9bcabd1ea569b85c2b8ce7bb86ed0c871953712b"
79
79
  }
@@ -16,8 +16,9 @@ import React from 'react';
16
16
  import {Icon} from '@iconify/react';
17
17
  import {Table} from 'apache-arrow';
18
18
 
19
+ import {useParcaContext} from '@parca/components';
19
20
  import {ProfileType} from '@parca/parser';
20
- import {getLastItem} from '@parca/utilities';
21
+ import {formatDateTimeDownToMS, getLastItem} from '@parca/utilities';
21
22
 
22
23
  import {hexifyAddress, truncateString, truncateStringReverse} from '../utils';
23
24
  import {ExpandOnHover} from './ExpandOnHoverValue';
@@ -141,7 +142,9 @@ const TooltipMetaInfo = ({table, row}: {table: Table<any>; row: number}): React.
141
142
  mappingFile,
142
143
  mappingBuildID,
143
144
  inlined,
145
+ timestamp,
144
146
  } = useGraphTooltipMetaInfo({table, row});
147
+ const {timezone} = useParcaContext();
145
148
 
146
149
  const labels = labelPairs.map(
147
150
  (l): React.JSX.Element => (
@@ -159,9 +162,19 @@ const TooltipMetaInfo = ({table, row}: {table: Table<any>; row: number}): React.
159
162
 
160
163
  return (
161
164
  <>
165
+ {timestamp == null || timestamp === 0n ? (
166
+ <div className="pt-2" />
167
+ ) : (
168
+ <tr>
169
+ <td className="w-1/4 pt-2">Timestamp</td>
170
+ <td className="w-3/4 pt-2 break-all">
171
+ {formatDateTimeDownToMS(new Date(Number(timestamp / 1000000n)), timezone)}
172
+ </td>{' '}
173
+ </tr>
174
+ )}
162
175
  <tr>
163
- <td className="w-1/4 pt-2">File</td>
164
- <td className="w-3/4 pt-2 break-all">
176
+ <td className="w-1/4">File</td>
177
+ <td className="w-3/4 break-all">
165
178
  {functionFilename === '' ? (
166
179
  <NoData />
167
180
  ) : (
@@ -25,6 +25,7 @@ import {
25
25
  FIELD_LOCATION_LINE,
26
26
  FIELD_MAPPING_BUILD_ID,
27
27
  FIELD_MAPPING_FILE,
28
+ FIELD_TIMESTAMP,
28
29
  } from '../../ProfileIcicleGraph/IcicleGraphArrow';
29
30
  import {arrowToString} from '../../ProfileIcicleGraph/IcicleGraphArrow/utils';
30
31
  import {ProfileSource} from '../../ProfileSource';
@@ -47,6 +48,7 @@ interface GraphTooltipMetaInfoData {
47
48
  mappingFile: string | null;
48
49
  mappingBuildID: string | null;
49
50
  inlined: boolean | null;
51
+ timestamp: bigint | null;
50
52
  }
51
53
 
52
54
  export const useGraphTooltipMetaInfo = ({table, row}: Props): GraphTooltipMetaInfoData => {
@@ -66,6 +68,7 @@ export const useGraphTooltipMetaInfo = ({table, row}: Props): GraphTooltipMetaIn
66
68
  locationLine !== 0n ? locationLine : functionStartLine !== 0n ? functionStartLine : undefined;
67
69
  const labelPrefix = 'labels.';
68
70
  const labelColumnNames = table.schema.fields.filter(field => field.name.startsWith(labelPrefix));
71
+ const timestamp = table.getChild(FIELD_TIMESTAMP)?.get(row);
69
72
 
70
73
  const {queryServiceClient, enableSourcesView} = useParcaContext();
71
74
  const {profileSource} = useProfileViewContext();
@@ -140,5 +143,6 @@ export const useGraphTooltipMetaInfo = ({table, row}: Props): GraphTooltipMetaIn
140
143
  mappingBuildID,
141
144
  mappingFile,
142
145
  inlined,
146
+ timestamp,
143
147
  };
144
148
  };
@@ -189,6 +189,10 @@ const RawUtilizationMetrics = ({
189
189
  );
190
190
 
191
191
  const highlighted = useMemo(() => {
192
+ if (series.length === 0) {
193
+ return null;
194
+ }
195
+
192
196
  // Return the closest point as the highlighted point
193
197
  const closestPointPerSeries = series.map(function (s) {
194
198
  const distances = s.values.map(d => {
@@ -19,7 +19,7 @@ import {formatDateTimeDownToMS, valueFormatter} from '@parca/utilities';
19
19
  interface TooltipProps {
20
20
  x: number;
21
21
  y: number;
22
- timestamp: Date;
22
+ timestamp: Date | number;
23
23
  value: number;
24
24
  containerWidth: number;
25
25
  }
@@ -352,7 +352,7 @@ export const AreaGraph = ({
352
352
  <Tooltip
353
353
  x={mousePosition[0]}
354
354
  y={mousePosition[1]}
355
- timestamp={new Date(hoverData.timestamp)}
355
+ timestamp={hoverData.timestamp}
356
356
  value={hoverData.value}
357
357
  containerWidth={width}
358
358
  />
@@ -52,6 +52,7 @@ export const ThreeCPUStrips = {
52
52
  onSelectedTimeframe: (index: number, bounds: NumberDuo): void => {
53
53
  console.log('onSelectedTimeframe', index, bounds);
54
54
  },
55
+ bounds: [mockData[0][0].timestamp, mockData[0][mockData[0].length - 1].timestamp],
55
56
  },
56
57
  render: function Component(args: any): JSX.Element {
57
58
  const [, setArgs] = useArgs();
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import {useMemo, useState} from 'react';
14
+ import {useState} from 'react';
15
15
 
16
16
  import {Icon} from '@iconify/react';
17
17
  import * as d3 from 'd3';
@@ -32,6 +32,7 @@ interface Props {
32
32
  };
33
33
  onSelectedTimeframe: (labels: LabelSet, bounds: NumberDuo | undefined) => void;
34
34
  width?: number;
35
+ bounds: NumberDuo;
35
36
  }
36
37
 
37
38
  export const labelSetToString = (labelSet?: LabelSet): string => {
@@ -65,27 +66,17 @@ export const MetricsGraphStrips = ({
65
66
  selectedTimeframe,
66
67
  onSelectedTimeframe,
67
68
  width,
69
+ bounds,
68
70
  }: Props): JSX.Element => {
69
71
  const [collapsedIndices, setCollapsedIndices] = useState<number[]>([]);
70
72
 
71
73
  // @ts-expect-error
72
74
  const color = d3.scaleOrdinal(d3.schemeObservable10);
73
75
 
74
- const bounds = useMemo(() => {
75
- const bounds: NumberDuo = data.length > 0 ? [Infinity, -Infinity] : [0, 1];
76
- data.forEach(cpuData => {
77
- cpuData.forEach(dataPoint => {
78
- bounds[0] = Math.min(bounds[0], dataPoint.timestamp);
79
- bounds[1] = Math.max(bounds[1], dataPoint.timestamp);
80
- });
81
- });
82
- return [0, bounds[1] - bounds[0]] as NumberDuo;
83
- }, [data]);
84
-
85
76
  return (
86
77
  <div className="flex flex-col gap-1 relative my-0 ml-[70px]" style={{width: width ?? '100%'}}>
87
78
  <TimelineGuide
88
- bounds={[BigInt(bounds[0]), BigInt(bounds[1])]}
79
+ bounds={[BigInt(0), BigInt(bounds[1] - bounds[0])]}
89
80
  width={width ?? 1468}
90
81
  height={getTimelineGuideHeight(cpus, collapsedIndices)}
91
82
  margin={1}
@@ -13,16 +13,15 @@
13
13
 
14
14
  import React from 'react';
15
15
 
16
- import {Binary, StructRow} from 'apache-arrow';
17
16
  import cx from 'classnames';
18
17
  import twColors from 'tailwindcss/colors';
19
18
 
20
19
  import {scaleLinear} from '@parca/utilities';
21
20
 
22
- import {FIELD_CHILDREN, FIELD_CUMULATIVE, FIELD_GROUPBY_METADATA} from '.';
21
+ import {FIELD_CHILDREN, FIELD_CUMULATIVE, FIELD_DURATION, FIELD_TIMESTAMP} from '.';
23
22
  import {ProfileSource} from '../../ProfileSource';
24
23
  import {IcicleNode, IcicleNodeProps, RowHeight} from './IcicleGraphNodes';
25
- import {arrowToString, boundsFromProfileSource} from './utils';
24
+ import {boundsFromProfileSource} from './utils';
26
25
 
27
26
  interface IcicleChartRootNodeSpecificProps {
28
27
  profileSource?: ProfileSource;
@@ -58,8 +57,9 @@ export const IcicleChartRootNode = React.memo(function IcicleChartRootNodeNonMem
58
57
  profileSource,
59
58
  }: IcicleNodeProps & IcicleChartRootNodeSpecificProps): React.JSX.Element {
60
59
  // get the columns to read from
60
+ const durationColumn = table.getChild(FIELD_DURATION);
61
+ const timestampColumn = table.getChild(FIELD_TIMESTAMP);
61
62
  const cumulativeColumn = table.getChild(FIELD_CUMULATIVE);
62
- const groupByMetadata = table.getChild(FIELD_GROUPBY_METADATA);
63
63
  const cumulative = cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
64
64
  const childRows: number[] = Array.from<number>(
65
65
  table.getChild(FIELD_CHILDREN)?.get(row) ?? []
@@ -83,18 +83,12 @@ export const IcicleChartRootNode = React.memo(function IcicleChartRootNodeNonMem
83
83
  return (
84
84
  <>
85
85
  {childRows.map(row => {
86
- const groupByFields = (
87
- groupByMetadata?.get(row) as StructRow<Record<string, Binary>>
88
- ).toJSON();
86
+ const duration = durationColumn?.get(row) !== null ? BigInt(durationColumn?.get(row)) : 0n;
87
+ const timestamp =
88
+ timestampColumn?.get(row) !== null ? BigInt(timestampColumn?.get(row)) : 0n;
89
89
 
90
- const tsStr = arrowToString(groupByFields.time_nanos) as string;
91
-
92
- const tsNanos = BigInt(parseInt(tsStr, 10));
93
- const durationStr = arrowToString(groupByFields.duration) as string;
94
- const duration = parseInt(durationStr, 10);
95
-
96
- const x = tsXScale(tsNanos);
97
- const width = tsXScale(tsNanos + BigInt(Math.round(duration))) - x;
90
+ const x = tsXScale(timestamp);
91
+ const width = tsXScale(timestamp + BigInt(Math.round(Number(duration)))) - x;
98
92
 
99
93
  const cumulative =
100
94
  cumulativeColumn?.get(row) !== null ? BigInt(cumulativeColumn?.get(row)) : 0n;
@@ -138,7 +138,7 @@ export function MetricsGraphSection({
138
138
  <button
139
139
  onClick={() => setDisplayHideMetricsGraphButton(!showMetricsGraph)}
140
140
  className={cx(
141
- 'hidden z-10 px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900',
141
+ 'hidden px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900',
142
142
  showMetricsGraph && 'absolute right-0 bottom-3 !flex',
143
143
  !showMetricsGraph && 'relative !flex ml-auto'
144
144
  )}
@@ -35,7 +35,8 @@ export interface ProfileSelection {
35
35
  ProfileSource: () => ProfileSource;
36
36
  Type: () => string;
37
37
  }
38
- const timeFormat = (timezone?: string): string => {
38
+
39
+ export const timeFormat = (timezone?: string): string => {
39
40
  if (timezone !== undefined) {
40
41
  return 'yyyy-MM-dd HH:mm:ss';
41
42
  }