Skip to content

Commit e3cbd18

Browse files
committed
[benchmark] Improved docs and tests
* Added check for running by test number. * Documented “dry run” using `--list`. * Moved real run test to the end. * Added checks for logging benchmarks measurements (header and stats). * Added check that specifying the same test multiple times runs it just once.
1 parent 43390e8 commit e3cbd18

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

test/benchmark/Benchmark_O.test.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,25 @@ LISTALL-SAME: unstable
4545
LISTALL: AngryPhonebook
4646
````
4747

48-
````
49-
RUN: %Benchmark_O AngryPhonebook --num-iters=1 \
50-
RUN: | %FileCheck %s --check-prefix NUMITERS1
51-
NUMITERS1: AngryPhonebook,1
52-
NUMITERS1-NOT: 0,0,0,0,0
53-
````
48+
## Benchmark Selection
49+
The logic for filtering tests based on specified names, indices and tags
50+
is shared between the default "run" and `--list` commands. It is tested on
51+
the list command, which is much faster, because it runs no benchmarks.
52+
It provides us with ability to do a "dry run".
5453

55-
Should run benchmark by name, even if its tags match the default skip-tags
56-
(unstable,skip). Ackermann is marked unstable
54+
Run benchmark by name (even if its tags match the skip-tags) or test number:
5755

5856
````
59-
RUN: %Benchmark_O Ackermann | %FileCheck %s --check-prefix NAMEDSKIP
57+
RUN: %Benchmark_O Ackermann --list | %FileCheck %s --check-prefix NAMEDSKIP
6058
NAMEDSKIP: Ackermann
6159
60+
RUN: %Benchmark_O 1 --list | %FileCheck %s --check-prefix RUNBYNUMBER
61+
RUNBYNUMBER: Ackermann
62+
````
63+
64+
Composition of `tags` and `skip-tags`:
65+
66+
````
6267
RUN: %Benchmark_O --list --tags=Dictionary,Array \
6368
RUN: | %FileCheck %s --check-prefix ANDTAGS
6469
ANDTAGS: TwoSum
@@ -80,3 +85,23 @@ ORSKIPTAGS-NOT: DictOfArraysToArrayOfDicts
8085
ORSKIPTAGS: Fibonacci
8186
ORSKIPTAGS-NOT: RomanNumbers
8287
````
88+
89+
## Running Benchmarks
90+
Each real benchmark execution takes about a second. If possible, multiple checks
91+
are combined into one run to minimize the test time.
92+
93+
````
94+
RUN: %Benchmark_O AngryPhonebook --num-iters=1 \
95+
RUN: | %FileCheck %s --check-prefix NUMITERS1 \
96+
RUN: --check-prefix LOGHEADER \
97+
RUN: --check-prefix LOGBENCH
98+
LOGHEADER-LABEL: #,TEST,SAMPLES,MIN(us),MAX(us),MEAN(us),SD(us),MEDIAN(us)
99+
LOGBENCH: {{[0-9]+}},
100+
NUMITERS1: AngryPhonebook,1
101+
NUMITERS1-NOT: 0,0,0,0,0
102+
LOGBENCH-SAME: ,{{[0-9]+}},{{[0-9]+}},{{[0-9]+}},{{[0-9]+}},{{[0-9]+}}
103+
104+
RUN: %Benchmark_O 1 Ackermann 1 | %FileCheck %s --check-prefix RUNJUSTONCE
105+
RUNJUSTONCE-LABEL: 1,Ackermann
106+
RUNJUSTONCE-NOT: 1,Ackermann
107+
````

0 commit comments

Comments
 (0)