Skip to content

Commit c386956

Browse files
authored
Format perf numbers (#1009)
resolves: automation/issues/305 Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
1 parent 00dbd36 commit c386956

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

test-result-summary-client/src/TrafficLight/MetricsTable.jsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,23 @@ const MetricsTable = ({ type, id, benchmarkName }) => {
113113
const pivot = zip(...pageData);
114114

115115
const stats = pivot.map((p) => {
116-
const mean = math.mean(p.map(({ value }) => value));
116+
const mean = Number(
117+
math.mean(p.map(({ value }) => value))
118+
).toFixed(0);
117119
const max = math.max(p.map(({ value }) => value));
118120
const min = math.min(p.map(({ value }) => value));
119-
const median = math.median(p.map(({ value }) => value));
120-
const std = math
121-
.std(p.map(({ value }) => value))
122-
.toFixed(2);
123-
const CI = BenchmarkMath.confidence_interval(
124-
p.map(({ value }) => value)
125-
).toFixed(3);
121+
const median = Number(
122+
math.median(p.map(({ value }) => value))
123+
).toFixed(0);
124+
const std = Number(
125+
math.std(p.map(({ value }) => value))
126+
).toFixed(2);
127+
const CI =
128+
Number(
129+
BenchmarkMath.confidence_interval(
130+
p.map(({ value }) => value)
131+
) * 100
132+
).toFixed(2) + '%';
126133
return {
127134
mean,
128135
max,

test-result-summary-client/src/TrafficLight/TrafficLight.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ function TrafficLight() {
173173
let percentage = -1;
174174
const testValues = testBuild.statValues;
175175
const baselineValues = baselineBuild.statValues;
176-
const testScore = testValues.mean;
177-
const baselineScore = baselineValues.mean;
176+
const testScore = Number(testValues.mean).toFixed(0);
177+
const baselineScore = Number(baselineValues.mean).toFixed(0);
178178
if (testBuild.higherbetter) {
179179
percentage = Number((testScore * 100) / baselineScore).toFixed(
180180
2
@@ -185,11 +185,11 @@ function TrafficLight() {
185185
);
186186
}
187187

188-
const testCI = Number(testValues.CI).toFixed(3);
189-
const baselineCI = Number(baselineValues.CI).toFixed(3);
190-
const totalCI = Number(testValues.CI + baselineValues.CI).toFixed(
191-
3
192-
);
188+
const testCI = Number(testValues.CI * 100).toFixed(2) + '%';
189+
const baselineCI = Number(baselineValues.CI * 100).toFixed(2) + '%';
190+
const totalCI =
191+
Number((testValues.CI + baselineValues.CI) * 100).toFixed(2) +
192+
'%';
193193

194194
let icon = iconRed;
195195
if (percentage > 98) {

0 commit comments

Comments
 (0)