@parca/profile 0.16.63 → 0.16.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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.64](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.63...@parca/profile@0.16.64) (2022-11-08)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.16.63](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.62...@parca/profile@0.16.63) (2022-11-08)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -74,20 +74,29 @@ var TooltipMetaInfo = function (_a) {
74
74
  if (hoveringNode.meta === undefined)
75
75
  return _jsx(_Fragment, {});
76
76
  // populate meta from the flamegraph metadata tables
77
- if (locations !== undefined) {
78
- var location_1 = locations[hoveringNode.meta.locationIndex];
77
+ if (locations !== undefined &&
78
+ hoveringNode.meta.locationIndex !== undefined &&
79
+ hoveringNode.meta.locationIndex !== 0) {
80
+ var location_1 = locations[hoveringNode.meta.locationIndex - 1];
79
81
  hoveringNode.meta.location = location_1;
80
- if (mappings !== undefined) {
81
- var mapping = mappings[location_1.mappingIndex];
82
- if (strings !== undefined) {
83
- mapping.file = strings[mapping.fileStringIndex];
84
- mapping.buildId = strings[mapping.buildIdStringIndex];
82
+ if (location_1 !== undefined) {
83
+ if (mappings !== undefined &&
84
+ location_1.mappingIndex !== undefined &&
85
+ location_1.mappingIndex !== 0) {
86
+ var mapping = mappings[location_1.mappingIndex - 1];
87
+ if (strings !== undefined && mapping !== undefined) {
88
+ mapping.file =
89
+ (mapping === null || mapping === void 0 ? void 0 : mapping.fileStringIndex) !== undefined ? strings[mapping.fileStringIndex] : '';
90
+ mapping.buildId =
91
+ (mapping === null || mapping === void 0 ? void 0 : mapping.buildIdStringIndex) !== undefined ? strings[mapping.buildIdStringIndex] : '';
92
+ }
93
+ hoveringNode.meta.mapping = mapping;
85
94
  }
86
- hoveringNode.meta.mapping = mapping;
87
- }
88
- location_1.lines.forEach(function (line) {
89
- if (functions !== undefined && hoveringNode.meta !== undefined) {
90
- var func = functions[line.functionIndex];
95
+ if (functions !== undefined &&
96
+ location_1.lines !== undefined &&
97
+ hoveringNode.meta.lineIndex !== undefined &&
98
+ hoveringNode.meta.lineIndex < location_1.lines.length) {
99
+ var func = functions[location_1.lines[hoveringNode.meta.lineIndex].functionIndex - 1];
91
100
  if (strings !== undefined) {
92
101
  func.name = strings[func.nameStringIndex];
93
102
  func.systemName = strings[func.systemNameStringIndex];
@@ -95,7 +104,7 @@ var TooltipMetaInfo = function (_a) {
95
104
  }
96
105
  hoveringNode.meta.function = func;
97
106
  }
98
- });
107
+ }
99
108
  }
100
109
  var getTextForFile = function (hoveringNode) {
101
110
  var _a, _b, _c, _d;
@@ -56,14 +56,19 @@ function IcicleRect(_a) {
56
56
  } }), width > 5 && (_jsx("svg", __assign({ width: width - 5, height: height }, { children: _jsx("text", __assign({ x: 5, y: 15, style: { fontSize: '12px' } }, { children: name })) })))] })));
57
57
  }
58
58
  export function nodeLabel(node, strings, mappings, locations, functions) {
59
- var _a, _b;
59
+ var _a, _b, _c;
60
60
  if (((_a = node.meta) === null || _a === void 0 ? void 0 : _a.locationIndex) === undefined)
61
61
  return '<unknown>';
62
- var location = locations[node.meta.locationIndex];
63
- var mappingFile = strings[mappings[location.mappingIndex].fileStringIndex];
64
- var mappingString = "".concat(mappingFile !== '' ? '[' + ((_b = getLastItem(mappingFile)) !== null && _b !== void 0 ? _b : '') + '] ' : '');
62
+ if (((_b = node.meta) === null || _b === void 0 ? void 0 : _b.locationIndex) === 0)
63
+ return '<unknown>';
64
+ var location = locations[node.meta.locationIndex - 1];
65
+ var mapping = location.mappingIndex !== undefined || location.mappingIndex !== 0
66
+ ? mappings[location.mappingIndex - 1]
67
+ : undefined;
68
+ var mappingFile = (mapping === null || mapping === void 0 ? void 0 : mapping.fileStringIndex) !== undefined ? strings[mapping.fileStringIndex] : '';
69
+ var mappingString = "".concat(mappingFile !== '' ? '[' + ((_c = getLastItem(mappingFile)) !== null && _c !== void 0 ? _c : '') + '] ' : '');
65
70
  if (location.lines.length > 0) {
66
- var funcName = strings[functions[location.lines[0].functionIndex].nameStringIndex];
71
+ var funcName = strings[functions[location.lines[node.meta.lineIndex].functionIndex - 1].nameStringIndex];
67
72
  return "".concat(mappingString, " ").concat(funcName);
68
73
  }
69
74
  var address = hexifyAddress(location.address);
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.63",
3
+ "version": "0.16.64",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@iconify/react": "^3.2.2",
7
- "@parca/client": "^0.16.53",
8
- "@parca/components": "^0.16.58",
7
+ "@parca/client": "^0.16.54",
8
+ "@parca/components": "^0.16.59",
9
9
  "@parca/dynamicsize": "^0.16.51",
10
10
  "@parca/functions": "^0.16.51",
11
11
  "@parca/parser": "^0.16.50",
@@ -40,5 +40,5 @@
40
40
  "access": "public",
41
41
  "registry": "https://registry.npmjs.org/"
42
42
  },
43
- "gitHead": "a244d1d0c99589df268a4d93a56c9c67cce6236f"
43
+ "gitHead": "38667cf5c5702dff21fdfeb5d9f1053be97a1f9d"
44
44
  }
@@ -19,12 +19,7 @@ import {CallgraphNode, FlamegraphNode, FlamegraphNodeMeta, FlamegraphRootNode} f
19
19
  import {getLastItem, valueFormatter} from '@parca/functions';
20
20
  import useIsShiftDown from '@parca/components/src/hooks/useIsShiftDown';
21
21
  import {hexifyAddress, truncateString} from '../';
22
- import {
23
- Function,
24
- Location,
25
- Mapping,
26
- Line,
27
- } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
22
+ import {Function, Location, Mapping} from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
28
23
 
29
24
  interface GraphTooltipProps {
30
25
  x: number;
@@ -86,22 +81,37 @@ const TooltipMetaInfo = ({
86
81
  if (hoveringNode.meta === undefined) return <></>;
87
82
 
88
83
  // populate meta from the flamegraph metadata tables
89
- if (locations !== undefined) {
90
- const location = locations[hoveringNode.meta.locationIndex];
84
+ if (
85
+ locations !== undefined &&
86
+ hoveringNode.meta.locationIndex !== undefined &&
87
+ hoveringNode.meta.locationIndex !== 0
88
+ ) {
89
+ const location = locations[hoveringNode.meta.locationIndex - 1];
91
90
  hoveringNode.meta.location = location;
92
91
 
93
- if (mappings !== undefined) {
94
- const mapping = mappings[location.mappingIndex];
95
- if (strings !== undefined) {
96
- mapping.file = strings[mapping.fileStringIndex];
97
- mapping.buildId = strings[mapping.buildIdStringIndex];
92
+ if (location !== undefined) {
93
+ if (
94
+ mappings !== undefined &&
95
+ location.mappingIndex !== undefined &&
96
+ location.mappingIndex !== 0
97
+ ) {
98
+ const mapping = mappings[location.mappingIndex - 1];
99
+ if (strings !== undefined && mapping !== undefined) {
100
+ mapping.file =
101
+ mapping?.fileStringIndex !== undefined ? strings[mapping.fileStringIndex] : '';
102
+ mapping.buildId =
103
+ mapping?.buildIdStringIndex !== undefined ? strings[mapping.buildIdStringIndex] : '';
104
+ }
105
+ hoveringNode.meta.mapping = mapping;
98
106
  }
99
- hoveringNode.meta.mapping = mapping;
100
- }
101
107
 
102
- location.lines.forEach((line: Line) => {
103
- if (functions !== undefined && hoveringNode.meta !== undefined) {
104
- const func = functions[line.functionIndex];
108
+ if (
109
+ functions !== undefined &&
110
+ location.lines !== undefined &&
111
+ hoveringNode.meta.lineIndex !== undefined &&
112
+ hoveringNode.meta.lineIndex < location.lines.length
113
+ ) {
114
+ const func = functions[location.lines[hoveringNode.meta.lineIndex].functionIndex - 1];
105
115
  if (strings !== undefined) {
106
116
  func.name = strings[func.nameStringIndex];
107
117
  func.systemName = strings[func.systemNameStringIndex];
@@ -109,7 +119,7 @@ const TooltipMetaInfo = ({
109
119
  }
110
120
  hoveringNode.meta.function = func;
111
121
  }
112
- });
122
+ }
113
123
  }
114
124
 
115
125
  const getTextForFile = (hoveringNode: FlamegraphNode): string => {
@@ -149,16 +149,24 @@ export function nodeLabel(
149
149
  functions: Function[]
150
150
  ): string {
151
151
  if (node.meta?.locationIndex === undefined) return '<unknown>';
152
+ if (node.meta?.locationIndex === 0) return '<unknown>';
152
153
 
153
- const location = locations[node.meta.locationIndex];
154
- const mappingFile = strings[mappings[location.mappingIndex].fileStringIndex];
154
+ const location = locations[node.meta.locationIndex - 1];
155
+ const mapping =
156
+ location.mappingIndex !== undefined || location.mappingIndex !== 0
157
+ ? mappings[location.mappingIndex - 1]
158
+ : undefined;
159
+
160
+ const mappingFile =
161
+ mapping?.fileStringIndex !== undefined ? strings[mapping.fileStringIndex] : '';
155
162
 
156
163
  const mappingString: string = `${
157
164
  mappingFile !== '' ? '[' + (getLastItem(mappingFile) ?? '') + '] ' : ''
158
165
  }`;
159
166
 
160
167
  if (location.lines.length > 0) {
161
- const funcName = strings[functions[location.lines[0].functionIndex].nameStringIndex];
168
+ const funcName =
169
+ strings[functions[location.lines[node.meta.lineIndex].functionIndex - 1].nameStringIndex];
162
170
  return `${mappingString} ${funcName}`;
163
171
  }
164
172