@parca/profile 0.16.444 → 0.16.446

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 (48) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts.map +1 -1
  3. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.js +9 -2
  4. package/dist/ProfileIcicleGraph/index.d.ts.map +1 -1
  5. package/dist/ProfileIcicleGraph/index.js +3 -11
  6. package/dist/ProfileView/ColorStackLegend.d.ts.map +1 -0
  7. package/dist/{ProfileIcicleGraph/IcicleGraphArrow → ProfileView}/ColorStackLegend.js +2 -2
  8. package/dist/ProfileView/VisualizationPanel.d.ts +4 -1
  9. package/dist/ProfileView/VisualizationPanel.d.ts.map +1 -1
  10. package/dist/ProfileView/VisualizationPanel.js +4 -6
  11. package/dist/ProfileView/index.d.ts.map +1 -1
  12. package/dist/ProfileView/index.js +33 -10
  13. package/dist/ProfileViewWithData.d.ts.map +1 -1
  14. package/dist/ProfileViewWithData.js +1 -3
  15. package/dist/Table/index.d.ts +2 -29
  16. package/dist/Table/index.d.ts.map +1 -1
  17. package/dist/Table/index.js +65 -160
  18. package/dist/Table/utils/functions.d.ts +49 -0
  19. package/dist/Table/utils/functions.d.ts.map +1 -0
  20. package/dist/Table/utils/functions.js +181 -0
  21. package/dist/components/ActionButtons/GroupByDropdown.js +1 -1
  22. package/dist/components/ActionButtons/SortByDropdown.d.ts +3 -0
  23. package/dist/components/ActionButtons/SortByDropdown.d.ts.map +1 -0
  24. package/dist/components/ActionButtons/SortByDropdown.js +49 -0
  25. package/dist/components/VisualisationToolbar/MultiLevelDropdown.d.ts.map +1 -1
  26. package/dist/components/VisualisationToolbar/MultiLevelDropdown.js +3 -27
  27. package/dist/components/VisualisationToolbar/TableColumnsDropdown.d.ts.map +1 -1
  28. package/dist/components/VisualisationToolbar/TableColumnsDropdown.js +3 -1
  29. package/dist/components/VisualisationToolbar/index.d.ts +11 -0
  30. package/dist/components/VisualisationToolbar/index.d.ts.map +1 -1
  31. package/dist/components/VisualisationToolbar/index.js +13 -6
  32. package/dist/styles.css +1 -1
  33. package/package.json +3 -3
  34. package/src/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.tsx +19 -2
  35. package/src/ProfileIcicleGraph/index.tsx +2 -18
  36. package/src/{ProfileIcicleGraph/IcicleGraphArrow → ProfileView}/ColorStackLegend.tsx +2 -2
  37. package/src/ProfileView/VisualizationPanel.tsx +13 -10
  38. package/src/ProfileView/index.tsx +59 -9
  39. package/src/ProfileViewWithData.tsx +1 -3
  40. package/src/Table/index.tsx +138 -265
  41. package/src/Table/utils/functions.ts +284 -0
  42. package/src/components/ActionButtons/GroupByDropdown.tsx +1 -1
  43. package/src/components/ActionButtons/SortByDropdown.tsx +84 -0
  44. package/src/components/VisualisationToolbar/MultiLevelDropdown.tsx +7 -30
  45. package/src/components/VisualisationToolbar/TableColumnsDropdown.tsx +3 -1
  46. package/src/components/VisualisationToolbar/index.tsx +103 -58
  47. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ColorStackLegend.d.ts.map +0 -1
  48. /package/dist/{ProfileIcicleGraph/IcicleGraphArrow → ProfileView}/ColorStackLegend.d.ts +0 -0
@@ -11,8 +11,9 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import {Profiler, ProfilerProps, useCallback, useEffect, useState} from 'react';
14
+ import {Profiler, ProfilerProps, useCallback, useEffect, useMemo, useState} from 'react';
15
15
 
16
+ import {Table as ArrowTable, tableFromIPC} from 'apache-arrow';
16
17
  import cx from 'classnames';
17
18
  import {scaleLinear} from 'd3';
18
19
  import graphviz from 'graphviz-wasm';
@@ -42,10 +43,17 @@ import {Callgraph} from '../';
42
43
  import {jsonToDot} from '../Callgraph/utils';
43
44
  import ProfileIcicleGraph from '../ProfileIcicleGraph';
44
45
  import {FIELD_FUNCTION_NAME} from '../ProfileIcicleGraph/IcicleGraphArrow';
46
+ import useMappingList, {
47
+ useFilenamesList,
48
+ } from '../ProfileIcicleGraph/IcicleGraphArrow/useMappingList';
45
49
  import {ProfileSource} from '../ProfileSource';
46
50
  import {SourceView} from '../SourceView';
47
51
  import {Table} from '../Table';
48
- import VisualisationToolbar from '../components/VisualisationToolbar';
52
+ import VisualisationToolbar, {
53
+ IcicleGraphToolbar,
54
+ TableToolbar,
55
+ } from '../components/VisualisationToolbar';
56
+ import ColorStackLegend from './ColorStackLegend';
49
57
  import {ProfileViewContextProvider} from './ProfileViewContext';
50
58
  import {VisualizationPanel} from './VisualizationPanel';
51
59
 
@@ -130,10 +138,22 @@ export const ProfileView = ({
130
138
  const [graphvizLoaded, setGraphvizLoaded] = useState(false);
131
139
  const [callgraphSVG, setCallgraphSVG] = useState<string | undefined>(undefined);
132
140
  const [currentSearchString, setSearchString] = useURLState<string | undefined>('search_string');
141
+ const [colorStackLegend] = useURLState<string | undefined>('color_stack_legend');
142
+ const [colorBy] = useURLState('color_by');
143
+
144
+ const isColorStackLegendEnabled = colorStackLegend === 'true';
145
+ const colorByValue = colorBy === undefined || colorBy === '' ? 'binary' : (colorBy as string);
133
146
 
134
147
  const isDarkMode = useAppSelector(selectDarkMode);
135
148
  const isMultiPanelView = dashboardItems.length > 1;
136
149
 
150
+ const table: ArrowTable<any> | null = useMemo(() => {
151
+ return flamegraphData.arrow !== undefined ? tableFromIPC(flamegraphData.arrow.record) : null;
152
+ }, [flamegraphData.arrow]);
153
+
154
+ const mappingsList = useMappingList(flamegraphData.metadataMappingFiles);
155
+ const filenamesList = useFilenamesList(table);
156
+
137
157
  const {perf, profileViewExternalMainActions} = useParcaContext();
138
158
 
139
159
  useEffect(() => {
@@ -195,11 +215,9 @@ export const ProfileView = ({
195
215
  const getDashboardItemByType = ({
196
216
  type,
197
217
  isHalfScreen,
198
- setActionButtons,
199
218
  }: {
200
219
  type: string;
201
220
  isHalfScreen: boolean;
202
- setActionButtons: (actionButtons: JSX.Element) => void;
203
221
  }): JSX.Element => {
204
222
  switch (type) {
205
223
  case 'icicle': {
@@ -221,13 +239,12 @@ export const ProfileView = ({
221
239
  filtered={filtered}
222
240
  profileType={profileSource?.ProfileType()}
223
241
  loading={flamegraphData.loading}
224
- setActionButtons={setActionButtons}
225
242
  error={flamegraphData.error}
226
243
  isHalfScreen={isHalfScreen}
227
244
  width={
228
245
  dimensions?.width !== undefined
229
246
  ? isHalfScreen
230
- ? (dimensions.width - 40) / 2
247
+ ? (dimensions.width - 54) / 2
231
248
  : dimensions.width - 16
232
249
  : 0
233
250
  }
@@ -260,10 +277,10 @@ export const ProfileView = ({
260
277
  data={topTableData.arrow?.record}
261
278
  unit={topTableData.unit}
262
279
  profileType={profileSource?.ProfileType()}
263
- setActionButtons={setActionButtons}
264
280
  currentSearchString={currentSearchString}
265
281
  setSearchString={setSearchString}
266
282
  isHalfScreen={isHalfScreen}
283
+ metadataMappingFiles={flamegraphData.metadataMappingFiles}
267
284
  />
268
285
  ) : (
269
286
  <></>
@@ -276,7 +293,6 @@ export const ProfileView = ({
276
293
  data={sourceData.data}
277
294
  total={total}
278
295
  filtered={filtered}
279
- setActionButtons={setActionButtons}
280
296
  />
281
297
  ) : (
282
298
  <></>
@@ -342,6 +358,28 @@ export const ProfileView = ({
342
358
  hasProfileSource &&
343
359
  (profileViewExternalMainActions === null || profileViewExternalMainActions === undefined);
344
360
 
361
+ const clearSelection = useCallback((): void => {
362
+ setSearchString?.('');
363
+ }, [setSearchString]);
364
+
365
+ const getActionButtonsWithMultiPanelView = (): {
366
+ icicle: JSX.Element;
367
+ table: JSX.Element;
368
+ } => {
369
+ return {
370
+ icicle: <IcicleGraphToolbar curPath={curPath} setNewCurPath={setNewCurPath} />,
371
+ table: (
372
+ <TableToolbar
373
+ profileType={profileSource?.ProfileType()}
374
+ total={total}
375
+ filtered={filtered}
376
+ clearSelection={clearSelection}
377
+ currentSearchString={currentSearchString}
378
+ />
379
+ ),
380
+ };
381
+ };
382
+
345
383
  return (
346
384
  <KeyDownProvider>
347
385
  <ProfileViewContextProvider value={{profileSource, compareMode}}>
@@ -400,6 +438,14 @@ export const ProfileView = ({
400
438
  groupByLabels={flamegraphData.metadataLabels ?? []}
401
439
  />
402
440
 
441
+ {isColorStackLegendEnabled && (
442
+ <ColorStackLegend
443
+ compareMode={compareMode}
444
+ mappings={colorByValue === 'binary' ? mappingsList : filenamesList}
445
+ loading={flamegraphData.metadataLoading}
446
+ />
447
+ )}
448
+
403
449
  <div className="w-full" ref={ref}>
404
450
  <DragDropContext onDragEnd={onDragEnd}>
405
451
  <Droppable droppableId="droppable" direction="horizontal">
@@ -429,7 +475,10 @@ export const ProfileView = ({
429
475
  'w-full min-h-96',
430
476
  snapshot.isDragging
431
477
  ? 'bg-gray-200 dark:bg-gray-500'
432
- : 'bg-white dark:bg-gray-900'
478
+ : 'bg-white dark:bg-gray-900',
479
+ isMultiPanelView
480
+ ? 'border-2 border-gray-100 dark:border-gray-700 rounded-md p-3'
481
+ : ''
433
482
  )}
434
483
  >
435
484
  <VisualizationPanel
@@ -439,6 +488,7 @@ export const ProfileView = ({
439
488
  getDashboardItemByType={getDashboardItemByType}
440
489
  dragHandleProps={provided.dragHandleProps}
441
490
  index={index}
491
+ actionButtons={getActionButtonsWithMultiPanelView()}
442
492
  />
443
493
  </div>
444
494
  )}
@@ -81,11 +81,8 @@ export const ProfileViewWithData = ({
81
81
  profileSource,
82
82
  QueryRequest_ReportType.PROFILE_METADATA,
83
83
  {
84
- skip: !dashboardItems.includes('icicle'),
85
84
  nodeTrimThreshold,
86
85
  groupBy,
87
- invertCallStack,
88
- binaryFrameFilter: undefined,
89
86
  }
90
87
  );
91
88
 
@@ -97,6 +94,7 @@ export const ProfileViewWithData = ({
97
94
  error: tableError,
98
95
  } = useQuery(queryClient, profileSource, QueryRequest_ReportType.TABLE_ARROW, {
99
96
  skip: !dashboardItems.includes('table'),
97
+ binaryFrameFilter,
100
98
  });
101
99
 
102
100
  const {