@parca/profile 0.13.6 → 0.13.8

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.13.8](https://github.com/parca-dev/parca/compare/ui-v0.13.7...ui-v0.13.8) (2022-06-21)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## [0.13.6](https://github.com/parca-dev/parca/compare/ui-v0.13.5...ui-v0.13.6) (2022-06-14)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.13.6",
3
+ "version": "0.13.8",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.13.6",
@@ -19,5 +19,5 @@
19
19
  "access": "public",
20
20
  "registry": "https://registry.npmjs.org/"
21
21
  },
22
- "gitHead": "4d3b64d06db8d342cd858dd6c7e244279d33fa77"
22
+ "gitHead": "bcf2171c4374f29211901526ea1db51aff843d24"
23
23
  }
@@ -7,6 +7,8 @@ import {FlamegraphTooltip} from '@parca/components';
7
7
  import {getLastItem, diffColor, isSearchMatch, SEARCH_STRING_COLOR} from '@parca/functions';
8
8
  import {useAppSelector, selectDarkMode, selectSearchNodeString} from '@parca/store';
9
9
 
10
+ import {hexifyAddress} from './utils';
11
+
10
12
  interface IcicleGraphProps {
11
13
  graph: Flamegraph;
12
14
  sampleUnit: string;
@@ -120,11 +122,7 @@ export function nodeLabel(node: FlamegraphNode): string {
120
122
  if (node.meta.function?.name !== undefined && node.meta.function?.name !== '')
121
123
  return mapping + node.meta.function.name;
122
124
 
123
- const address = `${
124
- node.meta.location?.address !== undefined && node.meta.location?.address !== 0
125
- ? '0x' + node.meta.location.address.toString(16)
126
- : ''
127
- }`;
125
+ const address = hexifyAddress(node.meta.location?.address);
128
126
  const fallback = `${mapping}${address}`;
129
127
 
130
128
  return fallback === '' ? '<unknown>' : fallback;
package/src/TopTable.tsx CHANGED
@@ -9,6 +9,8 @@ import {
9
9
  } from '@parca/client';
10
10
  import {ProfileSource} from './ProfileSource';
11
11
  import {useQuery} from './useQuery';
12
+ import {hexifyAddress} from './utils';
13
+
12
14
  import './TopTable.styles.css';
13
15
 
14
16
  interface ProfileViewProps {
@@ -90,11 +92,8 @@ export const RowLabel = (meta: TopNodeMeta | undefined): string => {
90
92
  if (meta.function?.name !== undefined && meta.function?.name !== '')
91
93
  return `${mapping} ${meta.function.name}`;
92
94
 
93
- const addr = parseInt(meta.location?.address ?? '0', 10);
94
- const address = `${
95
- meta.location?.address !== undefined && addr !== 0 ? `0x${addr.toString(16)}` : ''
96
- }`;
97
- const fallback = `${mapping} ${address}`;
95
+ const address = hexifyAddress(meta.location?.address);
96
+ const fallback = `${mapping} ${address as string}`;
98
97
 
99
98
  return fallback === '' ? '<unknown>' : fallback;
100
99
  };
package/src/index.tsx CHANGED
@@ -2,3 +2,4 @@ export * from './IcicleGraph';
2
2
  export * from './ProfileIcicleGraph';
3
3
  export * from './ProfileSource';
4
4
  export * from './ProfileView';
5
+ export * from './utils';
package/src/utils.ts ADDED
@@ -0,0 +1,6 @@
1
+ export const hexifyAddress = (address?: string): string => {
2
+ if (address == null) {
3
+ return '';
4
+ }
5
+ return `0x${parseInt(address, 10).toString(16)}`;
6
+ };