Skip to content

Commit

Permalink
fix: 🚨 use Current for cpuinfo benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
dergecko committed Oct 28, 2024
1 parent 4e70b7b commit d256c6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions procfs/benches/cpuinfo.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use procfs::CpuInfo;
use procfs::Current;

fn bench_cpuinfo(c: &mut Criterion) {
c.bench_function("CpuInfo::new", |b| b.iter(|| black_box(CpuInfo::new().unwrap())));
c.bench_function("CpuInfo::current", |b| b.iter(|| black_box(CpuInfo::current().unwrap())));

let cpuinfo = black_box(CpuInfo::new().unwrap());
let cpuinfo = black_box(CpuInfo::current().unwrap());
c.bench_function("CpuInfo::get_info", |b| b.iter(|| black_box(cpuinfo.get_info(0))));
c.bench_function("CpuInfo::model_name", |b| b.iter(|| cpuinfo.model_name(0)));
c.bench_function("CpuInfo::vendor_id", |b| b.iter(|| cpuinfo.vendor_id(0)));
Expand Down

0 comments on commit d256c6d

Please sign in to comment.