Component¶
The component generator creates a report that is comprised of different types of components.
Options¶
- title:
Type(s):
[string, null]
, Default:NULL
Title for generated report
- description:
Type(s):
[string, null]
, Default:NULL
Description for generated report
- partition:
Type(s):
string[]
, Default:[]
Partition the data using these column names - components will be rendered for each partition
- filter:
Type(s):
[string, null]
, Default:NULL
If provided, filter our rows which do not match this expression
- components:
Type(s):
array[]
, Default:[]
List of component configuration objects, each component must feature a
component
key (e.g.table_aggregate
)
- tabbed:
Type(s):
bool
, Default:false
Render components in tabs when supported in the output renderer (e.g. HTML)
- tab_labels:
Type(s):
string[]
, Default:[]
List of labels for tabs, will replace the default labels from left to right.
Example¶
Given the following configuration:
{
"runner.path": "NothingBench.php",
"runner.executor": "debug",
"runner.env_enabled_providers": ["test"],
"report.generators": {
"chart": {
"generator": "component",
"components": [
{
"component": "bar_chart_aggregate",
"title": "Example Bar Chart",
"x_partition": ["benchmark_name"],
"bar_partition": ["suite_tag"],
"y_expr": "mode(partition[\"result_time_avg\"])",
"y_axes_label": "yValue as time precision 1"
},
{
"component": "table_aggregate",
"title": "Table",
"row": {
"benchmark": "first(partition[\"benchmark_name\"])",
"net_time": "sum(partition[\"result_time_net\"])"
}
}
]
}
}
}
When we run PHPBench with the configured report above:
phpbench run --report=chart
Then it generates all reports:
Example Bar Chart
10.0μs │ █
8.8μs │ █
7.5μs │ █
6.3μs │ █
5.0μs │ █
3.8μs │ █
2.5μs │ █
1.3μs │ █
└───
1
[█ <current>]
1: NothingBench
Table
+--------------+----------+
| benchmark | net_time |
+--------------+----------+
| NothingBench | 10 |
+--------------+----------+