Skip to content

Commit

Permalink
Add cras_bench instructions
Browse files Browse the repository at this point in the history
BUG=b:294176591
TEST=follow the readme

Change-Id: Ie0d64d7f762f1bec1d2ba54e6c7431f01094fde3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5082325
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Tested-by: chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com <chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
  • Loading branch information
afq984 authored and Chromeos LUCI committed Dec 4, 2023
1 parent c9cdf58 commit d36672d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions cras/benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# CRAS Benchmark

## Build instructions

1. Install dependencies:

1. Bazelisk: https://github.com/bazelbuild/bazelisk
1. System dependencies:
1. alsa
1. libevent
1. protobuf

1. Clone this repository and the webrtc-apm repository, so they are adjacent to each other.

```
git clone https://chromium.googlesource.com/chromiumos/third_party/adhd
git clone https://chromium.googlesource.com/chromiumos/third_party/webrtc-apm
```
1. Build `cras_bench` in the `adhd` directory:
```
cd adhd
bazelisk build //cras/benchmark:cras_bench --//:apm -c opt --action_env=CC=clang --action_env=CXX=clang++ --copt=-march=x86-64-v3
```
Notable options:
* `-c opt` - enables optimized builds
* `--action_env=CC=clang` `--action_env=CXX=clang++` - sets the C and C++ compilers to clang
* `--copt` - sets C/C++ compiler options. You can add more with more `--copt=...`
* `--copt=-march=x86-64-v3` - sets the target architecture. You should use the best one that fits your system
The resulting binary will be in `bazel-bin/cras/benchmark/cras_bench`.
## Run instructions
Run with
```
bazel-bin/cras/benchmark/cras_bench --benchmark_out=result.json
```
to get a JSON file with the results at `result.json`.
## Editor note
Run `bazel cquery --//:apm 'filter("^@pkg_config", deps(//cras/benchmark:cras_bench))'`
to query up-to-date system dependencies.

0 comments on commit d36672d

Please sign in to comment.