Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,14 @@ jobs:

# Nightly is only needed for the `--profile bench` line. Once that is stabilized,
# then this line is no longer needed.
- name: Install nightly toolchain
run: rustup toolchain install nightly
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-03-08
override: true

- name: Run the example with dhat-rs to collect memory information
run: |
cargo run --package icu_benchmark_memory -- --os ${{ matrix.os }} ${{ matrix.examples }}
cargo run --package icu_benchmark_memory -- --os ${{ matrix.os }} ${{ matrix.examples }} --toolchain nightly-2021-03-08

# Benchmarking & dashboards job > (unmerged PR only) Convert benchmark output into
# dashboard HTML in a commit of a branch of the local repo.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: nightly-2021-03-08
override: true

- uses: actions-rs/cargo@v1
Expand Down
41 changes: 30 additions & 11 deletions tools/benchmark/memory/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::{fs, io::BufReader};
struct ProcessedArgs {
os: Option<String>,
examples: Vec<String>,
toolchain: String,
}

fn process_cli_args() -> ProcessedArgs {
Expand All @@ -26,14 +27,22 @@ fn process_cli_args() -> ProcessedArgs {
.required(true)
.help("The space separated list of examples to run, with the form <PACKAGE>/<EXAMPLE>")
)
.arg(
Arg::with_name("OS")
.long("os")
.takes_value(true)
.value_name("OS")
.required(false)
.help("Nests the results of the benchmark in a folder per-OS, primarily needed by CI.")
).get_matches();
.arg(
Arg::with_name("OS")
.long("os")
.takes_value(true)
.value_name("OS")
.required(false)
.help("Nests the results of the benchmark in a folder per-OS, primarily needed by CI.")
)
.arg(
Arg::with_name("TOOLCHAIN")
.long("toolchain")
.takes_value(true)
.value_name("TOOLCHAIN")
.required(false)
.help("The toolchain for cargo to use. Defaults to nightly.")
).get_matches();

ProcessedArgs {
// Validate the OS, and copy into an owned String.
Expand Down Expand Up @@ -61,6 +70,11 @@ fn process_cli_args() -> ProcessedArgs {
example.to_string()
})
.collect(),

toolchain: matches
.value_of("TOOLCHAIN")
.unwrap_or("nightly")
.to_string(),
}
}

Expand Down Expand Up @@ -121,7 +135,11 @@ fn get_meta_data(root_dir: &Path) -> Metadata {
/// d. Add the output to an `ndjson` file.
/// e. Move the dhat-heap.json file to the benchmark folder.
fn main() {
let ProcessedArgs { os, examples } = process_cli_args();
let ProcessedArgs {
os,
examples,
toolchain,
} = process_cli_args();

let root_dir = {
let mut path = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").expect("$CARGO_MANIFEST_DIR"));
Expand Down Expand Up @@ -206,8 +224,9 @@ fn main() {
println!("[memory] Starting example {:?}", example);

let mut run_example = Command::new("cargo")
// +nightly is required for unstable options.
.arg("+nightly")
// +nightly is required for unstable options. This option is used by the CI to provide
// a pinned version number for nightly.
.arg(format!("+{}", toolchain))
.arg("run")
.arg("--example")
.arg(example)
Expand Down