Skip to content

Commit 2945c3f

Browse files
committed
ui: fix value formatting for celsius and watts
1 parent 8f8e8bc commit 2945c3f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ui/packages/shared/profile/src/ProfileSelector/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const ProfileSelector = ({
119119
onSearchHook,
120120
}: ProfileSelectorProps): JSX.Element => {
121121
const {heightStyle} = useMetricsGraphDimensions(comparing, false);
122-
const {viewComponent, additionalMetricsGraph, additionalMetricsGraphPosition} = useParcaContext();
122+
const {viewComponent, additionalMetricsGraph} = useParcaContext();
123123
const [queryBrowserMode, setQueryBrowserMode] = useURLState('query_browser_mode');
124124
const batchUpdates = useURLStateBatch();
125125

@@ -291,8 +291,7 @@ const ProfileSelector = ({
291291
return (
292292
<>
293293
<div className="mb-2 flex flex-col">
294-
{additionalMetricsGraphPosition === 'top' &&
295-
additionalMetricsGraph?.({querySelection, queryClient, suffix})}
294+
{additionalMetricsGraph?.({querySelection, queryClient, suffix})}
296295
<LabelsQueryProvider
297296
setMatchersString={setMatchersString}
298297
runQuery={setQueryExpression}
@@ -371,8 +370,6 @@ const ProfileSelector = ({
371370
(profileTypesData?.types == null || profileTypesData.types.length === 0)
372371
}
373372
/>
374-
{additionalMetricsGraphPosition === 'bottom' &&
375-
additionalMetricsGraph?.({querySelection, queryClient, suffix})}
376373
</>
377374
);
378375
};

ui/packages/shared/utilities/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ const unitsInCelsius = {
100100
unit: {multiplier: 1, symbol: '°C'},
101101
};
102102

103+
const unitsInMillicelsius = {
104+
unit: {multiplier: 1e7, symbol: '°C'},
105+
};
106+
107+
const unitsInMicrowatts = {
108+
unit: {multiplier: 1e6, symbol: 'W'},
109+
kilo: {multiplier: 1e9, symbol: 'kW'},
110+
mega: {multiplier: 1e12, symbol: 'MW'},
111+
giga: {multiplier: 1e15, symbol: 'GW'},
112+
};
113+
103114
const unitsInHertz = {
104115
unit: {multiplier: 1, symbol: 'Hz'},
105116
kilo: {multiplier: 1e3, symbol: 'kHz'},
@@ -115,8 +126,10 @@ const knownValueFormatters = {
115126
'CPU Cores': unitsInCores,
116127
milliseconds: unitsInTimeMs,
117128
watts: unitsInWatts,
129+
microwatts: unitsInMicrowatts,
118130
bytes_per_second: unitsInBytesPerSecond,
119131
celsius: unitsInCelsius,
132+
millicelsius: unitsInMillicelsius,
120133
hertz: unitsInHertz,
121134
};
122135

0 commit comments

Comments
 (0)