Commit 37e6bbcc authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Facebook GitHub Bot

folly/Benchmark.cpp: right align user metrics

Summary:
Right align so number units are easier to compare.

```name=before
======================================================================================================
some bench                             relative  time/iter  iters/s  cpu-cycles  instructions
======================================================================================================
A                                                  33.19us   30.13K  100.61K     217.49K
B                                        93.71%    35.41us   28.24K  106.19K     224.50K
C                                                  24.37us   41.03K  71.86K      92.74K
D                                       163.37%    14.92us   67.02K  45.04K      77.66K
======================================================================================================
```

```name=after
======================================================================================================
some bench                             relative  time/iter  iters/s  cpu-cycles  instructions
======================================================================================================
A                                                  33.92us   29.48K     102.56K       217.49K
B                                        94.27%    35.99us   27.79K     113.75K       224.50K
C                                                  23.53us   42.51K      72.80K        92.73K
D                                       154.72%    15.20us   65.77K      47.21K        77.66K
======================================================================================================
````

Reviewed By: yfeldblum, ot, philippv

Differential Revision: D30081837

fbshipit-source-id: cbbfb7e381910c102eefca13475840c58a8b3361
parent d9abea1b
......@@ -326,22 +326,22 @@ class BenchmarkResultsPrinter {
switch (ptr->type) {
case UserMetric::Type::TIME:
printf(
" %-*s",
" %*s",
int(name.length()),
readableTime(ptr->value, 2).c_str());
break;
case UserMetric::Type::METRIC:
printf(
" %-*s",
" %*s",
int(name.length()),
metricReadable(ptr->value, 2).c_str());
break;
case UserMetric::Type::CUSTOM:
default:
printf(" %-*" PRId64, int(name.length()), ptr->value);
printf(" %*" PRId64, int(name.length()), ptr->value);
}
} else {
printf(" %-*s", int(name.length()), "NaN");
printf(" %*s", int(name.length()), "NaN");
}
}
printf("\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment