Skip to content

Commit 5ff0db4

Browse files
committed
fix units/second report
fixes #2
1 parent de7d5c5 commit 5ff0db4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/src/benchmark.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ class BenchmarkResult {
5757
if (units != null) {
5858
output
5959
..labeled('units', units)
60-
..labeled('units/second', runsPerSecond)
60+
..labeled('units/second', unitsPerSecond(units))
6161
..labeled('time per unit',
6262
Printer.formatMicroseconds(microsecondsPerUnit(units)));
6363
}
6464
}
6565

66+
double unitsPerSecond(int units) =>
67+
Duration.microsecondsPerSecond / microsecondsPerUnit(units);
68+
6669
double microsecondsPerUnit(int units) =>
6770
averageRunTime.inMicroseconds / units;
6871
}

lib/src/printer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Printer {
3333
{String thousandsSeparator = ' ',
3434
int? decimalPoints,
3535
String suffix = ' ',
36-
int lPadLength = 8}) {
36+
int lPadLength = 10}) {
3737
late String str;
3838

3939
if (number.isInfinite) {

0 commit comments

Comments
 (0)