fix: Patch coarsetime for MIPS AtomicU64 support
- Vendor coarsetime crate with portable-atomic fallback - Use portable-atomic on targets without 64-bit atomics - Patch crates.io to use local coarsetime - Fixes MIPS build failure (AtomicU64 missing)
This commit is contained in:
61
third_party/coarsetime/benches/benchmark.rs
vendored
Normal file
61
third_party/coarsetime/benches/benchmark.rs
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
use benchmark_simple::*;
|
||||
use coarsetime::*;
|
||||
use std::time;
|
||||
|
||||
fn main() {
|
||||
let options = &Options {
|
||||
iterations: 250_000,
|
||||
warmup_iterations: 25_000,
|
||||
min_samples: 5,
|
||||
max_samples: 10,
|
||||
max_rsd: 1.0,
|
||||
..Default::default()
|
||||
};
|
||||
bench_coarsetime_now(options);
|
||||
bench_coarsetime_recent(options);
|
||||
bench_coarsetime_elapsed(options);
|
||||
bench_coarsetime_elapsed_since_recent(options);
|
||||
bench_stdlib_now(options);
|
||||
bench_stdlib_elapsed(options);
|
||||
}
|
||||
|
||||
fn bench_coarsetime_now(options: &Options) {
|
||||
let b = Bench::new();
|
||||
Instant::update();
|
||||
let res = b.run(options, Instant::now);
|
||||
println!("coarsetime_now(): {}", res.throughput(1));
|
||||
}
|
||||
|
||||
fn bench_coarsetime_recent(options: &Options) {
|
||||
let b = Bench::new();
|
||||
Instant::update();
|
||||
let res = b.run(options, Instant::recent);
|
||||
println!("coarsetime_recent(): {}", res.throughput(1));
|
||||
}
|
||||
|
||||
fn bench_coarsetime_elapsed(options: &Options) {
|
||||
let b = Bench::new();
|
||||
let ts = Instant::now();
|
||||
let res = b.run(options, || ts.elapsed());
|
||||
println!("coarsetime_elapsed(): {}", res.throughput(1));
|
||||
}
|
||||
|
||||
fn bench_coarsetime_elapsed_since_recent(options: &Options) {
|
||||
let b = Bench::new();
|
||||
let ts = Instant::now();
|
||||
let res = b.run(options, || ts.elapsed_since_recent());
|
||||
println!("coarsetime_since_recent(): {}", res.throughput(1));
|
||||
}
|
||||
|
||||
fn bench_stdlib_now(options: &Options) {
|
||||
let b = Bench::new();
|
||||
let res = b.run(options, time::Instant::now);
|
||||
println!("stdlib_now(): {}", res.throughput(1));
|
||||
}
|
||||
|
||||
fn bench_stdlib_elapsed(options: &Options) {
|
||||
let b = Bench::new();
|
||||
let ts = time::Instant::now();
|
||||
let res = b.run(options, || ts.elapsed());
|
||||
println!("stdlib_elapsed(): {}", res.throughput(1));
|
||||
}
|
||||
Reference in New Issue
Block a user