Skip to content

Commit e1fcce2

Browse files
committed
docs: Add an example on adding a diff column
1 parent 8888764 commit e1fcce2

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

docs/report-generators/expression.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ Which yields:
6161
:language: bash
6262
:section: 2
6363

64+
For example you add a **diff** column:
65+
66+
.. approved:: ../../examples/Command/report-generators-column-diff
67+
:language: javascript
68+
:section: 0
69+
70+
Which yields:
71+
72+
.. approved:: ../../examples/Command/report-generators-column-diff
73+
:language: bash
74+
:section: 2
75+
6476
.. _generator_expression_aggregate:
6577

6678
Aggregate
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"runner.executor": "debug-example",
3+
"runner.iterations": 5,
4+
"runner.executors": {
5+
"debug-example": {
6+
"executor": "debug",
7+
"times":[10, 20, 30, 40, 50]
8+
}
9+
},
10+
"report.generators": {
11+
"my-report": {
12+
"generator": "expression",
13+
"aggregate": ["iteration_index"],
14+
"cols": {
15+
"subject": null,
16+
"mode": null,
17+
"diff": "format('%.2fx', mean(result_time_avg) / min(suite['result_time_avg']))"
18+
}
19+
}
20+
}
21+
}
22+
---
23+
phpbench run --report=my-report --executor=debug NothingBench.php --progress=none
24+
---
25+
+--------------+----------+-------+
26+
| subject | mode | diff |
27+
+--------------+----------+-------+
28+
| benchNothing | 10.000μs | 1.00x |
29+
| benchNothing | 20.000μs | 2.00x |
30+
| benchNothing | 30.000μs | 3.00x |
31+
| benchNothing | 40.000μs | 4.00x |
32+
| benchNothing | 50.000μs | 5.00x |
33+
+--------------+----------+-------+
34+

0 commit comments

Comments
 (0)