Skip to content

Commit

Permalink
store the creation timestamp of the benchmarked commit
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Dec 18, 2024
1 parent 323aa37 commit b83dcfe
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion benchmarker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ struct Commands(BTreeMap<String, Vec<String>>);
struct BenchData {
// What and when are we benchmarking
commit_hash: String,
commit_timestamp: u64,

// timestamp when the benchmark was started
timestamp: SystemTime,

// Where are we benchmarking it on
Expand Down Expand Up @@ -168,8 +171,26 @@ fn get_cpu_model() -> String {
}

fn main() {
let (commit_hash, commit_timestamp) = {
match env::var("GITHUB_SHA") {
Ok(sha) => {
// git show 27b31a568651dd725488e422e854095639d75af6 --no-patch --pretty=format:"%ct"
let output = Command::new("git")
.args(&["show", &sha, "--no-patch", "--pretty=format:\"%ct\""])
.output()
.unwrap();

let timestamp: u64 = String::from_utf8_lossy(&output.stdout).parse().unwrap();

(sha, timestamp)
}
Err(_) => (String::new(), 0),
}
};

let mut bench_data = BenchData {
commit_hash: env::var("GITHUB_SHA").unwrap_or_default(),
commit_hash,
commit_timestamp,
timestamp: SystemTime::now(),

arch: env::var("RUNNER_ARCH").unwrap_or_default(),
Expand Down

0 comments on commit b83dcfe

Please sign in to comment.