Table Aggregate

Render a table with aggregated data.

HTML output

HTML output

Options

title:

Type(s): [string, null], Default: NULL

Caption for the table

partition:

Type(s): [string, string[]], Default: []

Partition the data using these column names - the row expressions will to aggregate the data in each partition

row:

Type(s): array, Default: []

Set of expressions used to evaluate the partitions, the key is the column name, the value is the expression

Example

Given the following configuration:

{
    "runner.path": "NothingBench.php",
    "runner.executor": "debug",
    "runner.env_enabled_providers": ["test"],
    "report.generators": {
        "nested": {
            "generator": "component",
            "title": "My Aggregated Table",
            "components": [
                {
                    "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=nested

Then it generates the following with the console renderer:

My Aggregated Table
===================

Table
+--------------+----------+
| benchmark    | net_time |
+--------------+----------+
| NothingBench | 10       |
+--------------+----------+