Fix session out_dir state check

Anything after State.READY is ok as we don't change the number of runs
in a session anymore after that.

Change-Id: I64712f4bc95d7ada320b91ce7af31750ee5f9ed0
Reviewed-by: Igor Kraskevich <>
Commit-Queue: Camillo Bruni <>
1 file changed
tree: 69234d8e79de766997a544d2c6af1f965928960f
  1. binary_cache/
  2. chrome-extension-replay/
  3. config/
  4. crossbench/
  5. docs/
  6. tests/
  7. .coveragerc
  8. .gitattributes
  9. .gitignore
  10. .gitmodules
  11. .pylintrc
  12. .style.yapf
  13. .vpython3
  15. DEPS
  17. mypy.ini
  18. OWNERS
  19. poetry.lock
  21. pyproject.toml
  22. pytest.ini
  23. README.chromium


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

Mailing list:

Issues/Bugs: Tests > CrossBench

Supported Browsers: Chrome/Chromium, Firefox, Safari and Edge.

Supported OS: MacOS, Android, Linux and Windows.

Basic usage:

Chromium Devs (with a full chromium checkout)

Use the ./ script directly to run benchmarks (requires chrome's vpython3)

Standalone installation

  • Use pip install crossbench,
  • or use the “poetry” package manager, see the development section.

Running Workloads Examples

Run the latest speedometer benchmark 20 times with the system default browser (chrome-stable):

# Run chrome-stable by default:
./ speedometer --repeat=3

# Compare chrome browser versions and a local chrome build on jetstream:
./ jetstream --browser=chrome-stable --browser=chrome-m90 --browser=$PATH

Profile individual line items (with pprof on linux):

./ speedometer --probe='profiling' --separate

Use a custom chrome build and only run a subset of the stories:

./ speedometer --browser=$PATH --probe='profiling' --story='jQuery.*'

Profile a website for 17 seconds on Chrome M100 (auto-downloading on macOS and linux):

./ loading --browser=chrome-m100 --probe='profiling',17s

Collect perfetto data from loading separate websites on multiple attached android devices using the device ID or unique device names (see adb devices -l):

./ loading --probe-config=./config/probe/perfetto/default.config.hjson \
    --browser='Pixel_4:chrome-stable' --browser='AA00BB11:chrome-stable' \
    --parallel=platform \
    --url=,15s,,15s  --separate

Main Components


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

You can specify a browser with --browser=<name>. You can repeat the --browser argument to run multiple browser. If you need custom flags for multiple browsers use --browser-config (or pass simple flags after -- to the browser).

./ speedometer --browser=$BROWSER -- --enable-field-trial-config

--browser flag on desktop:

--browser=chrome-stableUse the installed Chrome stable on the host. Also works with beta, dev and canary versions.
--browser=edge-stableUse the installed Edge stable on the host. Also works with beta, dev and canary versions.
--browser=safari-stableUse the installed Safari stable version on the host. Also works with technology-preview
--browser=firefox-stableUse the installed Firefox stable version on the host. Also works with dev and nightly versions.
--browser=./out/Release/chromeUse a locally compiled chrome version. Any path to a chrome binary will work.
--browser=chrome-m123Download the latest M123 chrome release and install it locally
--browser=chrome-125.0.6422.112Download and install a specific chrome version.
--browser=chrome-M100...M123Download and install a range of 24 different chrome milestones.

--browser flag on mobile:

You can directly run on attached android devices using the device ID or unique device names. They need to have developer mode and usb-debugging enabled.

--browser=adb:chrome-stableUse Chrome stable on a single attached adb device. Note this will fail if there is more than one attached device.
--browser=Pixel_7_pro:chrome-canaryUse Chrome canary on an attached Pixel 7 Pro device. Note this will fail if there is more than one Pixel 7 pro attached.
--browser=2900FF00BB:chrome-devUse Chrome dev on an attached adb device with the serial id 2900FF00BB. Use adb devices -l to find the serial id.

Browser Config File

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.

./ speedometer --browser-config=config.hjson

The example file lists and explains all configuration details.

Remote WebDriver Interface

Crossbench also supports benchmarking browsers on remote machines running Linux or ChromeOS, via SSH. The remote machine is expected to have at least two ports open to the host: (a) the SSH port (typically 22), and (b) the WebDriver port (typically 9515). The remote browser example describes the configuration details for both Linux and ChromeOS.

On ChromeOS, Crossbench requires ChromeDriver to interact with Chrome, and Autotest for creating ephemeral sessions for testing. Both ChromeDriver and Autotest are pre-installed on ChromeOS test images. Detailed instructions for flashing Chromebooks with test images are provided at: go/arc-setup-dev-mode-dut#usb-cros-test-image.


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 probes subcommand to list all probes:

# List all probes:
./ describe probes

# List help for an individual probe:
./ describe probe v8.log

Inline Probe Config

Some probes can be configured, either with inline JSON when using --probe or in a separate --probe-config HJSON file. Use the describe command to list all options. The inline JSON or HJSON is the same format as used in the separate probe config files (see below).

# Get probe config details:
./ describe probe v8.log

# Use inline HJSON to configure a probe:
./ speedometer --probe='v8.log:{prof:true}'

Probe Config File

For complex probe setups you can use --probe-config=<file>. The example file lists and explains all configuration details. For the specific probe configuration properties consult the describe command.


Use the describe command to list all benchmark details:

# List all benchmark info:
./ describe benchmarks

# List an individual benchmark info:
./ describe benchmark speedometer_3.0

# List a benchmark's command line options:
./ speedometer_3.0 --help


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:

./ speedometer --help

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

./ speedometer --browser=$BROWSER --stories='.*Angular.*'



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

# a) On debian:
sudo apt-get install python3.10 python3-poetry
# b) With python 3.8 to 3.10 installed already:
pip3 install poetry

Check that you have poetry on your path and make sure you have the right $PATH settings.

poetry --help || echo "Please update your \$PATH to include poetry bin location";
# Depending on your setup, add one of the following to your $PATH:
echo "`python3 -m site --user-base`/bin";
python3 -c "import sysconfig; print(sysconfig.get_path('scripts'))";

Install the necessary dependencies from the lock file using poetry:

# Select the python version you want to use (3.8 to 3.10):
poetry env use 3.10
poetry install

# For python 3.11 you have to skip pytype support:
poetry env use 3.11
poetry install --without=dev-pytype


For local development / non-chromium installation you should use poetry run cb ... instead of ./ ....

Side-note, beware that poetry eats up an empty --:

# With
./ speedometer ... -- --custom-chrome-flag ...
# With poetry:
poetry run cb speedometer ... -- -- --custom-chrome-flag ...


poetry run pytest

Run detailed test coverage:

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

Run pytype type checker:

poetry run pytype -j auto .