@parca/profile 0.19.151 → 0.19.153

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 (29) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.d.ts +2 -1
  3. package/dist/GraphTooltipArrow/Content.d.ts.map +1 -1
  4. package/dist/GraphTooltipArrow/Content.js +203 -9
  5. package/dist/GraphTooltipArrow/gpuFrameDescriptions.d.ts +28 -0
  6. package/dist/GraphTooltipArrow/gpuFrameDescriptions.d.ts.map +1 -0
  7. package/dist/GraphTooltipArrow/gpuFrameDescriptions.js +845 -0
  8. package/dist/GraphTooltipArrow/index.d.ts +2 -1
  9. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  10. package/dist/GraphTooltipArrow/index.js +11 -2
  11. package/dist/GraphTooltipArrow/openInNewTab.d.ts +2 -0
  12. package/dist/GraphTooltipArrow/openInNewTab.d.ts.map +1 -0
  13. package/dist/GraphTooltipArrow/openInNewTab.js +40 -0
  14. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.d.ts.map +1 -1
  15. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +119 -56
  16. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  17. package/dist/ProfileMetricsGraph/index.js +7 -1
  18. package/dist/ProfileTypeSelector/index.d.ts.map +1 -1
  19. package/dist/ProfileTypeSelector/index.js +12 -0
  20. package/dist/styles.css +1 -1
  21. package/package.json +2 -2
  22. package/src/GraphTooltipArrow/Content.tsx +86 -5
  23. package/src/GraphTooltipArrow/gpuFrameDescriptions.test.ts +53 -0
  24. package/src/GraphTooltipArrow/gpuFrameDescriptions.ts +556 -0
  25. package/src/GraphTooltipArrow/index.tsx +13 -1
  26. package/src/GraphTooltipArrow/openInNewTab.ts +43 -0
  27. package/src/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.tsx +35 -2
  28. package/src/ProfileMetricsGraph/index.tsx +7 -1
  29. package/src/ProfileTypeSelector/index.tsx +12 -0
@@ -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 React, {memo, useEffect, useState} from 'react';
14
+ import React, {memo, useEffect, useRef, useState} from 'react';
15
15
 
16
16
  import GraphTooltipArrow from '../../GraphTooltipArrow';
17
17
  import GraphTooltipArrowContent from '../../GraphTooltipArrow/Content';
@@ -28,13 +28,45 @@ export const MemoizedTooltip = memo(function MemoizedTooltip({
28
28
  dockedMetainfo,
29
29
  }: MemoizedTooltipProps): React.JSX.Element | null {
30
30
  const [tooltipRow, setTooltipRow] = useState<number | null>(null);
31
+ const [shiftHeld, setShiftHeld] = useState(false);
32
+ const shiftHeldRef = useRef(false);
33
+
34
+ useEffect(() => {
35
+ shiftHeldRef.current = shiftHeld;
36
+ }, [shiftHeld]);
37
+
31
38
  const {table, total, totalUnfiltered, profileType, unit, compareAbsolute, tooltipId} =
32
39
  useTooltipContext();
33
40
 
41
+ useEffect(() => {
42
+ const onKeyDown = (e: KeyboardEvent): void => {
43
+ if (e.key === 'Shift') setShiftHeld(true);
44
+ };
45
+ const onKeyUp = (e: KeyboardEvent): void => {
46
+ if (e.key === 'Shift') setShiftHeld(false);
47
+ };
48
+ // If the user opens the attribution link, releases Shift in the new tab,
49
+ // and comes back — our window never saw the keyup, so the frozen state
50
+ // would stick. Clear it whenever focus leaves the tab.
51
+ const onBlurOrHide = (): void => setShiftHeld(false);
52
+ window.addEventListener('keydown', onKeyDown);
53
+ window.addEventListener('keyup', onKeyUp);
54
+ window.addEventListener('blur', onBlurOrHide);
55
+ document.addEventListener('visibilitychange', onBlurOrHide);
56
+ return () => {
57
+ window.removeEventListener('keydown', onKeyDown);
58
+ window.removeEventListener('keyup', onKeyUp);
59
+ window.removeEventListener('blur', onBlurOrHide);
60
+ document.removeEventListener('visibilitychange', onBlurOrHide);
61
+ };
62
+ }, []);
63
+
34
64
  // This component subscribes to tooltip updates through a callback
35
65
  // passed to the TooltipProvider, avoiding the need to lift state
36
66
  useEffect(() => {
37
67
  const handleTooltipUpdate = (event: CustomEvent<{row: number | null}>): void => {
68
+ // While Shift is held, lock the tooltip to its original frame.
69
+ if (shiftHeldRef.current) return;
38
70
  setTooltipRow(event.detail.row);
39
71
  };
40
72
 
@@ -82,7 +114,7 @@ export const MemoizedTooltip = memo(function MemoizedTooltip({
82
114
  return null;
83
115
  }
84
116
  return (
85
- <GraphTooltipArrow contextElement={contextElement}>
117
+ <GraphTooltipArrow contextElement={contextElement} frozen={shiftHeld}>
86
118
  <GraphTooltipArrowContent
87
119
  table={table}
88
120
  row={tooltipRow}
@@ -92,6 +124,7 @@ export const MemoizedTooltip = memo(function MemoizedTooltip({
92
124
  profileType={profileType}
93
125
  unit={unit}
94
126
  compareAbsolute={compareAbsolute}
127
+ frozen={shiftHeld}
95
128
  />
96
129
  </GraphTooltipArrow>
97
130
  );
@@ -368,9 +368,15 @@ const ProfileMetricsGraph = ({
368
368
  yAxisLabel = 'CPU Cores';
369
369
  yAxisUnit = '';
370
370
  }
371
- if (sampleType === 'cuda') {
371
+ if (sampleType === 'cuda' || sampleType === 'gpu_time') {
372
372
  yAxisLabel = 'GPU Time';
373
373
  }
374
+ if (sampleType === 'gpu_kernel_time') {
375
+ yAxisLabel = 'GPU Kernel Time';
376
+ }
377
+ if (sampleType === 'gpu_stall_time') {
378
+ yAxisLabel = 'GPU Stall Time';
379
+ }
374
380
  }
375
381
  if (sampleUnit === 'bytes') {
376
382
  yAxisLabel = 'Bytes per Second';
@@ -111,6 +111,18 @@ export const wellKnownProfiles: WellKnownProfiles = {
111
111
  name: 'On-GPU',
112
112
  help: 'Time spent on the GPU.',
113
113
  },
114
+ 'parca_agent:gpu_time:nanoseconds:gpu_time:nanoseconds:delta': {
115
+ name: 'On-GPU',
116
+ help: 'Time spent on the GPU. Combines kernel execution time and PC stall samples; the gpu_view label distinguishes the two views.',
117
+ },
118
+ 'parca_agent:gpu_kernel_time:nanoseconds:gpu_kernel_time:nanoseconds:delta': {
119
+ name: 'On-GPU',
120
+ help: 'GPU kernel execution time measured via CUDA runtime callbacks.',
121
+ },
122
+ 'parca_agent:gpu_stall_time:nanoseconds:gpu_stall_time:nanoseconds:delta': {
123
+ name: 'GPU Stalls',
124
+ help: 'GPU stall time accumulated from PC sampling — shows where threads were waiting on the GPU.',
125
+ },
114
126
  };
115
127
 
116
128
  export function flexibleWellKnownProfileMatching(name: string): WellKnownProfile | undefined {