Skip to content

Commit

Permalink
final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danking committed Dec 11, 2024
1 parent ad552a5 commit f1d631e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
runs-on: ubuntu
steps:
- uses: actions/checkout@v4
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375504701696:role/GitHubBenchmarkRole
aws-region: us-east-1
- name: Upload Commit Metadata
shell: bash
run: |
Expand Down Expand Up @@ -57,23 +62,14 @@ jobs:
RUSTFLAGS: '-C target-cpu=native'
run: |
cargo install cargo-criterion
cargo criterion --bench ${{ matrix.benchmark.id }} --message-format=json 2>&1 | tee out.json
cat out.json
sudo apt-get update && sudo apt-get install -y jq
jq --raw-input --compact-output '
fromjson?
| [ (if .mean != null then {name: .id, value: .mean.estimate, unit: .unit, range: ((.mean.upper_bound - .mean.lower_bound) / 2) } else {} end),
(if .throughput != null then {name: (.id + " throughput"), value: .throughput[].per_iteration, unit: .throughput[].unit, range: 0} else {} end),
{name, value, unit, range} ]
| .[]
| select(.value != null)
' \
out.json \
| jq --slurp --compact-output '.' >${{ matrix.benchmark.id }}.json
cargo criterion \
--bench ${{ matrix.benchmark.id }} \
--message-format=json \
| bash scripts/coerce-criterion-json.sh |
> ${{ matrix.benchmark.id }}.json
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
14 changes: 14 additions & 0 deletions bench-vortex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::env::temp_dir;
use std::fs::{create_dir_all, File};
use std::future::Future;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::{Arc, LazyLock};
use std::time::Duration;

Expand Down Expand Up @@ -279,8 +280,20 @@ pub struct JsonValue {
pub name: String,
pub unit: String,
pub value: u128,
pub commit_id: String,
}

pub static GIT_COMMIT_ID: LazyLock<String> = LazyLock::new(|| {
String::from_utf8(
Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.unwrap()
.stdout,
)
.unwrap()
});

impl Measurement {
pub fn to_json(&self) -> JsonValue {
let name = format!(
Expand All @@ -294,6 +307,7 @@ impl Measurement {
name,
unit: "ns".to_string(),
value: self.time.as_nanos(),
commit_id: GIT_COMMIT_ID.to_string(),
}
}
}
Expand Down

0 comments on commit f1d631e

Please sign in to comment.