From 39e494ac62a83abbac13481859fe3b83d94d4eb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Aug 2022 02:58:55 +0000 Subject: [PATCH] Bump sysinfo from 0.25.2 to 0.26.0 (#712) * Bump sysinfo from 0.25.2 to 0.26.0 Bumps [sysinfo](https://github.com/GuillaumeGomez/sysinfo) from 0.25.2 to 0.26.0. - [Release notes](https://github.com/GuillaumeGomez/sysinfo/releases) - [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md) - [Commits](https://github.com/GuillaumeGomez/sysinfo/commits) --- updated-dependencies: - dependency-name: sysinfo dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Adjust for sysinfo kb->bytes and increase mem threshold. Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: John Michael Burke --- Cargo.lock | 4 +-- console_backend/Cargo.toml | 2 +- console_backend/tests/mem_benches.rs | 37 +++++++++++++++------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9eb191598..0d523f577 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2879,9 +2879,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.25.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1594a36887d0f70096702bffadfb67dfbfe76ad4bf84605e86157dc9fce9961a" +checksum = "e08068324641dc7a50f3aa753e730594619ed9c5ba037b1b3920cb683e1a80b1" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys", diff --git a/console_backend/Cargo.toml b/console_backend/Cargo.toml index 1e60714d1..74062cc58 100644 --- a/console_backend/Cargo.toml +++ b/console_backend/Cargo.toml @@ -26,7 +26,7 @@ ordered-float = "3.0" ndarray = "0.15.6" glob = "0.3.0" criterion = "0.3.6" -sysinfo = "0.25.2" +sysinfo = "0.26.0" serialport = { git = "https://github.com/swift-nav/serialport-rs.git", default-features = false } directories = "4" anyhow = { version = "1", features = ["backtrace"] } diff --git a/console_backend/tests/mem_benches.rs b/console_backend/tests/mem_benches.rs index 40d15b6a4..fb4f71732 100644 --- a/console_backend/tests/mem_benches.rs +++ b/console_backend/tests/mem_benches.rs @@ -17,8 +17,8 @@ mod mem_bench_impl { const MINIMUM_MEM_READINGS: usize = 20; const DIFF_THRESHOLD: f32 = 0.25; - const MAXIMUM_MEM_USAGE_KB: f32 = 220000.0; - const ABSOLUTE_MINIMUM_MEM_USAGE: f32 = 1000.0; + const MAXIMUM_MEM_USAGE_BYTES: f32 = 30e6; + const ABSOLUTE_MINIMUM_MEM_USAGE: f32 = 1e6; const MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM: f32 = 0.5; /// Convert a 1D Vector to an ArrayView. @@ -55,18 +55,21 @@ mod mem_bench_impl { let mem_read_thread = thread::spawn(move || { let mut sys = System::new(); - let mut mem_readings_kb: Vec = vec![]; + let mut mem_readings_bytes: Vec = vec![]; let mut cpu_readings: Vec = vec![]; loop { sys.refresh_process(pid); let proc = sys.process(pid).unwrap(); - mem_readings_kb.push(proc.memory() as f32); + mem_readings_bytes.push(proc.memory() as f32); cpu_readings.push(proc.cpu_usage()); if mem_stop_recv.try_recv().is_ok() { break; } + // The file is roughly a minute long so storing memory usage + // every half second is sufficient. + thread::sleep(std::time::Duration::from_millis(500)); } - validate_memory_benchmark(&mem_readings_kb, &cpu_readings); + validate_memory_benchmark(&mem_readings_bytes, &cpu_readings); }); let recv_state = shared_state.clone(); @@ -119,7 +122,7 @@ mod mem_bench_impl { let mem_usage_mean = mems.mean_axis(Axis(0)).unwrap(); let mem_usage_std = mems.std_axis(Axis(0), 0.0); println!( - "Memory Usage: {:.2}kB ~ +/- {:.2}kB", + "Memory Usage: {:.2}bytes ~ +/- {:.2}bytes", mem_usage_mean, mem_usage_std ); let mem_usage_mean = mem_usage_mean.into_owned(); @@ -131,26 +134,26 @@ mod mem_bench_impl { let mem_usage_min = mem_usage_mean - mem_usage_std; - let mem_usage_over_amount = mem_usage_max - MAXIMUM_MEM_USAGE_KB; - let mem_usage_threshold = MAXIMUM_MEM_USAGE_KB * DIFF_THRESHOLD; - let worst_case_message = format!("Worst Case Memory Usage:\nThe mean memory usage, {:.2}kB, is added to the stdev, {:.2}kB, equaling {:.2}kB.", mem_usage_mean, mem_usage_std, mem_usage_max); - let worst_case_message = format!("{}\nThen this value is subtracted by the ideal maximum memory usage {:.2}kB equaling {:.2}kB.", worst_case_message, MAXIMUM_MEM_USAGE_KB, mem_usage_over_amount); + let mem_usage_over_amount = mem_usage_max - MAXIMUM_MEM_USAGE_BYTES; + let mem_usage_threshold = MAXIMUM_MEM_USAGE_BYTES * DIFF_THRESHOLD; + let worst_case_message = format!("Worst Case Memory Usage:\nThe mean memory usage, {:.2}bytes, is added to the stdev, {:.2}bytes, equaling {:.2}bytes.", mem_usage_mean, mem_usage_std, mem_usage_max); + let worst_case_message = format!("{}\nThen this value is subtracted by the ideal maximum memory usage {:.2}bytes equaling {:.2}bytes.", worst_case_message, MAXIMUM_MEM_USAGE_BYTES, mem_usage_over_amount); let worst_case_message = format!( - "{}\nThis amount is greater than {:.2}kB which is {:.2} of the maximum amount {:.2}.", - worst_case_message, mem_usage_threshold, DIFF_THRESHOLD, MAXIMUM_MEM_USAGE_KB + "{}\nThis amount is greater than {:.2}bytes which is {:.2} of the maximum amount {:.2}.", + worst_case_message, mem_usage_threshold, DIFF_THRESHOLD, MAXIMUM_MEM_USAGE_BYTES ); assert!( - (mem_usage_max - MAXIMUM_MEM_USAGE_KB) <= MAXIMUM_MEM_USAGE_KB * DIFF_THRESHOLD, + (mem_usage_max - MAXIMUM_MEM_USAGE_BYTES) <= MAXIMUM_MEM_USAGE_BYTES * DIFF_THRESHOLD, "{}", worst_case_message ); - assert!(*mem_usage_std <= MAXIMUM_MEM_USAGE_KB*MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM, - "Memory Standard Deviation, {:.2}kB, was greater than {:.2}kB which is {:.2} of the maximum memory usage {:.2}kB.", *mem_usage_std, ( - MAXIMUM_MEM_USAGE_KB*MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM), MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM, MAXIMUM_MEM_USAGE_KB + assert!(*mem_usage_std <= MAXIMUM_MEM_USAGE_BYTES*MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM, + "Memory Standard Deviation, {:.2}bytes, was greater than {:.2}bytes which is {:.2} of the maximum memory usage {:.2}bytes.", *mem_usage_std, ( + MAXIMUM_MEM_USAGE_BYTES*MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM), MAXIMUM_STANDARD_DEV_RATE_OF_MAXIMUM_MEM, MAXIMUM_MEM_USAGE_BYTES ); assert!( mem_usage_min >= ABSOLUTE_MINIMUM_MEM_USAGE, - "Best Case Memory Usage: {:.2}kB was less than absolute minimum {:.2}kB.", + "Best Case Memory Usage: {:.2}bytes was less than absolute minimum {:.2}bytes.", mem_usage_min, ABSOLUTE_MINIMUM_MEM_USAGE );