Use as_nanos in bench.rs and base.rs
This commit is contained in:
parent
285fc7d704
commit
cebbd9fcd3
2 changed files with 2 additions and 6 deletions
|
@ -108,7 +108,7 @@ pub fn compile_codegen_unit(
|
||||||
|
|
||||||
// We assume that the cost to run LLVM on a CGU is proportional to
|
// We assume that the cost to run LLVM on a CGU is proportional to
|
||||||
// the time we needed for codegenning it.
|
// the time we needed for codegenning it.
|
||||||
let cost = time_to_codegen.as_secs() * 1_000_000_000 + time_to_codegen.subsec_nanos() as u64;
|
let cost = time_to_codegen.as_nanos() as u64;
|
||||||
|
|
||||||
fn module_codegen(tcx: TyCtxt<'_>, cgu_name: Symbol) -> ModuleCodegen<ModuleLlvm> {
|
fn module_codegen(tcx: TyCtxt<'_>, cgu_name: Symbol) -> ModuleCodegen<ModuleLlvm> {
|
||||||
let cgu = tcx.codegen_unit(cgu_name);
|
let cgu = tcx.codegen_unit(cgu_name);
|
||||||
|
|
|
@ -98,10 +98,6 @@ fn fmt_thousands_sep(mut n: usize, sep: char) -> String {
|
||||||
output
|
output
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ns_from_dur(dur: Duration) -> u64 {
|
|
||||||
dur.as_secs() * 1_000_000_000 + (dur.subsec_nanos() as u64)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ns_iter_inner<T, F>(inner: &mut F, k: u64) -> u64
|
fn ns_iter_inner<T, F>(inner: &mut F, k: u64) -> u64
|
||||||
where
|
where
|
||||||
F: FnMut() -> T,
|
F: FnMut() -> T,
|
||||||
|
@ -110,7 +106,7 @@ where
|
||||||
for _ in 0..k {
|
for _ in 0..k {
|
||||||
black_box(inner());
|
black_box(inner());
|
||||||
}
|
}
|
||||||
ns_from_dur(start.elapsed())
|
start.elapsed().as_nanos() as u64
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter<T, F>(inner: &mut F) -> stats::Summary
|
pub fn iter<T, F>(inner: &mut F) -> stats::Summary
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue