@parca/profile 0.9.2 → 0.10.2

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,18 @@
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.10.2](https://github.com/parca-dev/parca/compare/ui-v0.10.1...ui-v0.10.2) (2022-03-01)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ # [0.10.0](https://github.com/parca-dev/parca/compare/ui-v0.9.3...ui-v0.10.0) (2022-02-28)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
14
+ ## [0.9.3](https://github.com/parca-dev/parca/compare/ui-v0.8.0...ui-v0.9.3) (2022-02-23)
15
+
16
+ **Note:** Version bump only for package @parca/profile
17
+
6
18
  ## [0.9.2](https://github.com/parca-dev/parca/compare/ui-v0.9.1...ui-v0.9.2) (2022-02-22)
7
19
 
8
20
  **Note:** Version bump only for package @parca/profile
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.9.2",
3
+ "version": "0.10.2",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
- "@parca/client": "^0.9.1",
7
- "@parca/dynamicsize": "^0.9.0",
8
- "@parca/parser": "^0.9.0",
6
+ "@parca/client": "^0.10.0",
7
+ "@parca/dynamicsize": "^0.10.0",
8
+ "@parca/parser": "^0.10.0",
9
9
  "d3-scale": "^4.0.2"
10
10
  },
11
11
  "main": "src/index.tsx",
@@ -19,5 +19,5 @@
19
19
  "access": "public",
20
20
  "registry": "https://registry.npmjs.org/"
21
21
  },
22
- "gitHead": "544d4819ace2db4570e2780876108636860ff0d2"
22
+ "gitHead": "0a4440a8d15256d3e1ce6868bd58ca08c39a652b"
23
23
  }
package/src/TopTable.tsx CHANGED
@@ -1,7 +1,13 @@
1
1
  import React, {useEffect, useState} from 'react';
2
2
 
3
3
  import {ProfileSource} from './ProfileSource';
4
- import {QueryRequest, QueryResponse, QueryServiceClient, ServiceError} from '@parca/client';
4
+ import {
5
+ QueryRequest,
6
+ QueryResponse,
7
+ QueryServiceClient,
8
+ ServiceError,
9
+ TopNodeMeta,
10
+ } from '@parca/client';
5
11
  import * as parca_query_v1alpha1_query_pb from '@parca/client/src/parca/query/v1alpha1/query_pb';
6
12
  import {getLastItem, valueFormatter} from '@parca/functions';
7
13
 
@@ -106,6 +112,26 @@ export const useQuery = (
106
112
  return result;
107
113
  };
108
114
 
115
+ export const RowLabel = (meta: TopNodeMeta.AsObject | undefined): string => {
116
+ if (meta === undefined) return '<unknown>';
117
+ const mapping = `${
118
+ meta?.mapping?.file !== undefined && meta?.mapping?.file !== ''
119
+ ? `[${getLastItem(meta.mapping.file)}]`
120
+ : ''
121
+ }`;
122
+ if (meta.pb_function?.name !== undefined && meta.pb_function?.name !== '')
123
+ return `${mapping} ${meta.pb_function.name}`;
124
+
125
+ const address = `${
126
+ meta.location?.address !== undefined && meta.location?.address !== 0
127
+ ? `0x${meta.location.address.toString(16)}`
128
+ : ''
129
+ }`;
130
+ const fallback = `${mapping} ${address}`;
131
+
132
+ return fallback === '' ? '<unknown>' : fallback;
133
+ };
134
+
109
135
  export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.Element => {
110
136
  const {response, error} = useQuery(queryClient, profileSource);
111
137
  const {items, requestSort, sortConfig} = useSortableData(response);
@@ -167,8 +193,7 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
167
193
  {items?.map((report, index) => (
168
194
  <tr key={index} className="hover:bg-[#62626212] dark:hover:bg-[#ffffff12]">
169
195
  <td className="text-xs py-1.5 pl-2 min-w-[150px] max-w-[450px]">
170
- {report.meta?.mapping?.file !== '' && [getLastItem(report.meta?.mapping?.file)]}{' '}
171
- {report.meta?.pb_function?.name}
196
+ {RowLabel(report.meta)}
172
197
  </td>
173
198
  <td className="text-xs min-w-[150px] max-w-[150px] py-1.5text-right">
174
199
  {valueFormatter(report.flat, unit, 2)}