@parca/profile 0.12.20 → 0.12.23
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/IcicleGraph.tsx +36 -21
- package/src/TopTable.tsx +1 -1
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.12.23](https://github.com/parca-dev/parca/compare/ui-v0.12.22...ui-v0.12.23) (2022-04-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
6
10
|
## [0.12.20](https://github.com/parca-dev/parca/compare/ui-v0.12.19...ui-v0.12.20) (2022-04-12)
|
|
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.12.
|
|
3
|
+
"version": "0.12.23",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@parca/client": "^0.12.20",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"access": "public",
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "adfe17cad5627ceb7e3ba6ffa0a3806bf8b7b8b4"
|
|
23
23
|
}
|
package/src/IcicleGraph.tsx
CHANGED
|
@@ -5,8 +5,9 @@ import {scaleLinear} from 'd3-scale';
|
|
|
5
5
|
import {Flamegraph, FlamegraphNode, FlamegraphRootNode} from '@parca/client';
|
|
6
6
|
import {usePopper} from 'react-popper';
|
|
7
7
|
import {getLastItem, valueFormatter} from '@parca/functions';
|
|
8
|
+
import {useAppSelector, selectDarkMode} from '@parca/store';
|
|
8
9
|
|
|
9
|
-
const RowHeight =
|
|
10
|
+
const RowHeight = 26;
|
|
10
11
|
|
|
11
12
|
const icicleRectStyles = {
|
|
12
13
|
cursor: 'pointer',
|
|
@@ -65,7 +66,7 @@ function IcicleRect({
|
|
|
65
66
|
/>
|
|
66
67
|
{width > 5 && (
|
|
67
68
|
<svg width={width - 5} height={height}>
|
|
68
|
-
<text x={5} y={
|
|
69
|
+
<text x={5} y={15} style={{fontSize: '12px'}}>
|
|
69
70
|
{name}
|
|
70
71
|
</text>
|
|
71
72
|
</svg>
|
|
@@ -90,22 +91,6 @@ interface IcicleGraphNodesProps {
|
|
|
90
91
|
xScale: (value: number) => number;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
function diffColor(diff: number, cumulative: number): string {
|
|
94
|
-
const prevValue = cumulative - diff;
|
|
95
|
-
const diffRatio = prevValue > 0 ? (Math.abs(diff) > 0 ? diff / prevValue : 0) : 1.0;
|
|
96
|
-
|
|
97
|
-
const diffTransparency =
|
|
98
|
-
Math.abs(diff) > 0 ? Math.min((Math.abs(diffRatio) / 2 + 0.5) * 0.8, 0.8) : 0;
|
|
99
|
-
const color =
|
|
100
|
-
diff === 0
|
|
101
|
-
? '#90c7e0'
|
|
102
|
-
: diff > 0
|
|
103
|
-
? `rgba(221, 46, 69, ${diffTransparency})`
|
|
104
|
-
: `rgba(59, 165, 93, ${diffTransparency})`;
|
|
105
|
-
|
|
106
|
-
return color;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
94
|
export function nodeLabel(node: FlamegraphNode.AsObject): string {
|
|
110
95
|
if (node.meta === undefined) return '<unknown>';
|
|
111
96
|
const mapping = `${
|
|
@@ -126,6 +111,26 @@ export function nodeLabel(node: FlamegraphNode.AsObject): string {
|
|
|
126
111
|
return fallback === '' ? '<unknown>' : fallback;
|
|
127
112
|
}
|
|
128
113
|
|
|
114
|
+
function diffColor(diff: number, cumulative: number, isDarkMode: boolean): string {
|
|
115
|
+
const prevValue = cumulative - diff;
|
|
116
|
+
const diffRatio = prevValue > 0 ? (Math.abs(diff) > 0 ? diff / prevValue : 0) : 1.0;
|
|
117
|
+
|
|
118
|
+
const diffTransparency =
|
|
119
|
+
Math.abs(diff) > 0 ? Math.min((Math.abs(diffRatio) / 2 + 0.5) * 0.8, 0.8) : 0;
|
|
120
|
+
|
|
121
|
+
const newSpanColor = isDarkMode ? '#B3BAE1' : '#929FEB';
|
|
122
|
+
const increasedSpanColor = isDarkMode
|
|
123
|
+
? `rgba(255, 177, 204, ${diffTransparency})`
|
|
124
|
+
: `rgba(254, 153, 187, ${diffTransparency})`;
|
|
125
|
+
const reducedSpanColor = isDarkMode
|
|
126
|
+
? `rgba(103, 158, 92, ${diffTransparency})`
|
|
127
|
+
: `rgba(164, 214, 153, ${diffTransparency})`;
|
|
128
|
+
|
|
129
|
+
const color = diff === 0 ? newSpanColor : diff > 0 ? increasedSpanColor : reducedSpanColor;
|
|
130
|
+
|
|
131
|
+
return color;
|
|
132
|
+
}
|
|
133
|
+
|
|
129
134
|
export function IcicleGraphNodes({
|
|
130
135
|
data,
|
|
131
136
|
x,
|
|
@@ -139,6 +144,8 @@ export function IcicleGraphNodes({
|
|
|
139
144
|
setCurPath,
|
|
140
145
|
curPath,
|
|
141
146
|
}: IcicleGraphNodesProps) {
|
|
147
|
+
const isDarkMode = useAppSelector(selectDarkMode);
|
|
148
|
+
|
|
142
149
|
const nodes =
|
|
143
150
|
curPath.length === 0 ? data : data.filter(d => d != null && curPath[0] === nodeLabel(d));
|
|
144
151
|
|
|
@@ -163,7 +170,7 @@ export function IcicleGraphNodes({
|
|
|
163
170
|
const name = nodeLabel(d);
|
|
164
171
|
const nextPath = path.concat([name]);
|
|
165
172
|
|
|
166
|
-
const color = diffColor(d.diff === undefined ? 0 : d.diff, d.cumulative);
|
|
173
|
+
const color = diffColor(d.diff === undefined ? 0 : d.diff, d.cumulative, isDarkMode);
|
|
167
174
|
|
|
168
175
|
const onClick = () => {
|
|
169
176
|
setCurPath(nextPath);
|
|
@@ -437,7 +444,9 @@ export function IcicleGraphRootNode({
|
|
|
437
444
|
setCurPath,
|
|
438
445
|
curPath,
|
|
439
446
|
}: IcicleGraphRootNodeProps) {
|
|
440
|
-
const
|
|
447
|
+
const isDarkMode = useAppSelector(selectDarkMode);
|
|
448
|
+
|
|
449
|
+
const color = diffColor(node.diff === undefined ? 0 : node.diff, node.cumulative, isDarkMode);
|
|
441
450
|
|
|
442
451
|
const onClick = () => setCurPath([]);
|
|
443
452
|
const onMouseEnter = () => setHoveringNode(node);
|
|
@@ -521,7 +530,13 @@ export default function IcicleGraph({graph, width, setCurPath, curPath}: IcicleG
|
|
|
521
530
|
hoveringNode={hoveringNode}
|
|
522
531
|
contextElement={svg.current}
|
|
523
532
|
/>
|
|
524
|
-
<svg
|
|
533
|
+
<svg
|
|
534
|
+
className="font-robotoMono"
|
|
535
|
+
width={width}
|
|
536
|
+
height={height}
|
|
537
|
+
onMouseMove={onMouseMove}
|
|
538
|
+
ref={svg}
|
|
539
|
+
>
|
|
525
540
|
<g ref={ref}>
|
|
526
541
|
<MemoizedIcicleGraphRootNode
|
|
527
542
|
node={graph.root}
|
package/src/TopTable.tsx
CHANGED
|
@@ -167,7 +167,7 @@ export const TopTable = ({queryClient, profileSource}: ProfileViewProps): JSX.El
|
|
|
167
167
|
|
|
168
168
|
return (
|
|
169
169
|
<>
|
|
170
|
-
<div className="w-full">
|
|
170
|
+
<div className="w-full font-robotoMono">
|
|
171
171
|
<table className="iciclegraph-table table-fixed text-left w-full divide-y divide-gray-200 dark:divide-gray-700">
|
|
172
172
|
<thead className="bg-gray-50 dark:bg-gray-800">
|
|
173
173
|
<tr>
|