@parca/profile 0.10.0 → 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 +4 -0
- package/package.json +2 -2
- package/src/TopTable.tsx +28 -3
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.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
|
+
|
|
6
10
|
# [0.10.0](https://github.com/parca-dev/parca/compare/ui-v0.9.3...ui-v0.10.0) (2022-02-28)
|
|
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.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.10.0",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"access": "public",
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
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 {
|
|
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
|
-
{
|
|
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)}
|