From 40ac0ef02965d27259ff69544fe35b181a2971ca Mon Sep 17 00:00:00 2001 From: Ohad Ravid Date: Tue, 4 Jun 2019 15:51:43 +0200 Subject: [PATCH] Added a bench for loaded modules --- src/benches/benchmark.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/benches/benchmark.rs b/src/benches/benchmark.rs index 6ad19cb..6431f22 100644 --- a/src/benches/benchmark.rs +++ b/src/benches/benchmark.rs @@ -49,6 +49,14 @@ pub struct Process { pub Caption: String, } +#[derive(Serialize, Deserialize, Debug)] +#[serde(rename = "CIM_ProcessExecutable")] +pub struct ProcessExecutable { + pub BaseAddress: String, + pub Antecedent: String, + pub Dependent: String, +} + fn get_accounts(con: &WMIConnection) { let accounts: Vec = con.query().unwrap(); } @@ -82,6 +90,10 @@ pub fn get_users_with_groups(con: &WMIConnection) { .unwrap(); } +pub fn get_modules(con: &WMIConnection) { + let execs: Vec = con.query().unwrap(); +} + fn criterion_benchmark(c: &mut Criterion) { // baseline: 41ms c.bench_function("get_accounts", |b| { @@ -119,6 +131,12 @@ fn criterion_benchmark(c: &mut Criterion) { let wmi_con = WMIConnection::new(COMLibrary::new().unwrap().into()).unwrap(); b.iter(|| get_users_with_groups(&wmi_con)) }); + + // baseline: 625ms. + c.bench_function("get_modules", |b| { + let wmi_con = WMIConnection::new(COMLibrary::new().unwrap().into()).unwrap(); + b.iter(|| get_modules(&wmi_con)) + }); } criterion_group!(benches, criterion_benchmark);