Skip to content

Commit e3acdab

Browse files
committed
fix(utils): render rme via formatNumber in the default table converter
The default `console.table` converter formatted `rme` with `.toFixed(2)`, which prints "Infinity%" when the latency mean is 0 (total timer saturation). Route it through `formatNumber` like the other displayed numbers so it renders "+∞%" and stays consistent with mean/p50/mad formatting; finite values are unaffected for realistic rme (< 1000%). Also clarify in the `Statistics.mad` doc that MAD is not scaled by the 1.4826 normal-consistency factor.
1 parent 0e99b1b commit e3acdab

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export interface Statistics {
518518
df: number
519519

520520
/**
521-
* median absolute deviation
521+
* median absolute deviation, not scaled by the 1.4826 normal-consistency factor
522522
*/
523523
mad: number
524524

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,9 @@ export const defaultConvertTaskResultForConsoleTable: ConsoleTableConverter = (
732732
'Task name': task.name,
733733
...(state === 'aborted-with-statistics' || state === 'completed'
734734
? {
735-
'Latency avg (ns)': `${formatNumber(mToNs(task.result.latency.mean))} \xb1 ${task.result.latency.rme.toFixed(2)}%`,
735+
'Latency avg (ns)': `${formatNumber(mToNs(task.result.latency.mean))} \xb1 ${formatNumber(task.result.latency.rme)}%`,
736736
'Latency med (ns)': `${formatNumber(mToNs(task.result.latency.p50))} \xb1 ${formatNumber(mToNs(task.result.latency.mad))}`,
737-
'Throughput avg (ops/s)': `${Math.round(task.result.throughput.mean).toString()} \xb1 ${task.result.throughput.rme.toFixed(2)}%`,
737+
'Throughput avg (ops/s)': `${Math.round(task.result.throughput.mean).toString()} \xb1 ${formatNumber(task.result.throughput.rme)}%`,
738738
'Throughput med (ops/s)': `${Math.round(task.result.throughput.p50).toString()} \xb1 ${Math.round(task.result.throughput.mad).toString()}`,
739739
Samples: task.result.latency.samplesCount,
740740
}

0 commit comments

Comments
 (0)