Preparation for custom HostEnvironments

HostEnvironments will be used to enforce or check certain host
settings (like CPU usage or open binaries). Currently we only support
one global setting, in the future this will be configurable via the
command line or separate config files.


- Rename CheckList to HostEnvironment
- Add HostEnvironmentConfig for future separate config file
- Replace skip_checklist Runner parameter with environment_config
- Add more return types

Change-Id: Ia1eba8befcef5085747bd3c08ff32d7c6719fc71
Reviewed-on: https://chromium-review.googlesource.com/c/crossbench/+/3986186
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
10 files changed
tree: 117ec6c3876e20ad5d126fdc0bea9b837d4022f1
  1. crossbench/
  2. docs/
  3. tests/
  4. .gitattributes
  5. .gitignore
  6. .pylintrc
  7. .style.yapf
  8. browser.config.example.hjson
  9. LICENSE
  10. OWNERS
  11. poetry.lock
  12. probe.config.example.hjson
  13. pyproject.toml
  14. README.chromium
  15. README.md
  16. scripts.py
README.md

Crossbench

Crossbench is a cross-browser/cross-benchmark runner to extract performance numbers.

Setup:

This project uses poetry deps and package scripts to setup the correct environment for testing and debugging.

pip3 install poetry

Install the necessary dependencies from lock file via poetry

poetry install

Basic usage:

poetry run crossbench speedometer_2.0 \
    --browser=/path/to/chromium \
    --stories=VanillaJS.* \
    --probe=profiling \
    --probe=v8.log

Run Unit tests

poetry run pytest

Run detailed test coverage:

poetry run pytest --cov=crossbench --cov-report=html

Run pytype type checker:

poetry run pytype -j auto crossbench

Main Components

Browsers

Crossbench supports running benchmarks on one or multiple browser configurations. The main implementation uses selenium for maximum system independence.

You can specify a single browser with --browser=<name>

poetry run crossbench speedometer_2.0 \
    --browser=/path/to/chromium  \
    -- \
        --browser-flag-foo \
        --browser-flag-bar \

For more complex scenarios you can use a browser.config.hjson file. It allows you to specify multiple browser and multiple flag configurations in a single file and produce performance numbers with a single invocation.

poetry run crossbench speedometer_2.0 \
    --browser-config=config.hjson

The example file lists and explains all configuration details.

Probes

Probes define a way to extract arbitrary (performance) numbers from a host or running browser. This can reach from running simple JS-snippets to extract page-specific numbers to system-wide profiling.

Multiple probes can be added with repeated --probe=XXX options. You can use the describe subcommand to list all probes:

poetry run crossbench describe probes

Benchmarks

Use the describe command to list all benchmark details:

poetry run crossbench describe benchmarks

Stories

Stories define sequences of browser interactions. This can be simply loading a URL and waiting for a given period of time, or in more complex scenarios, actively interact with a page and navigate multiple times.

Use --help or describe to list all stories for a benchmark:

poetry run crossbench speedometer_2.0 --help

Use --stories to list individual comma-separated story names, or use a regular expression as filter.

poetry run crossbench speedometer_2.0 \
    --browser=/path/to/chromium \
    --stories=VanillaJS.*