Skip to content

Commit

Permalink
bump dep
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Apr 9, 2023
1 parent 6e5d7f2 commit 3d27ce7
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 23 deletions.
93 changes: 75 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ core-foundation = "0.9.3"
mach2 = "0.4.1"

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.46.0", features = [
windows = { version = "0.48.0", features = [
"Win32_Foundation",
"Win32_System_ProcessStatus",
"Win32_System_Threading",
Expand Down
6 changes: 2 additions & 4 deletions src/app/data_harvester/memory/windows.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::mem::{size_of, zeroed};
use windows::Win32::Foundation::TRUE;
use windows::Win32::System::ProcessStatus::{K32GetPerformanceInfo, PERFORMANCE_INFORMATION};
use windows::Win32::System::ProcessStatus::{GetPerformanceInfo, PERFORMANCE_INFORMATION};

use crate::data_harvester::memory::MemHarvest;

Expand All @@ -13,9 +13,7 @@ pub(crate) fn get_swap_usage() -> Option<MemHarvest> {
// the bindings are "safe" to use with how we call them.
unsafe {
let mut perf_info: PERFORMANCE_INFORMATION = zeroed();
if K32GetPerformanceInfo(&mut perf_info, size_of::<PERFORMANCE_INFORMATION>() as u32)
== TRUE
{
if GetPerformanceInfo(&mut perf_info, size_of::<PERFORMANCE_INFORMATION>() as u32) == TRUE {
// Saturating sub by perf_info.PhysicalTotal for what sysinfo does.
let swap_total = perf_info.PageSize.saturating_mul(perf_info.CommitLimit) as u64;
let swap_used = perf_info.PageSize.saturating_mul(perf_info.CommitTotal) as u64;
Expand Down

0 comments on commit 3d27ce7

Please sign in to comment.