Skip to content

Commit

Permalink
fix for macos and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Jun 18, 2023
1 parent 791ce34 commit d4ff38f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/app/data_harvester/processes/unix/process_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) trait UnixProcessExt {
pcu / cpu_usage
} else {
pcu
};
} as f32;

let disk_usage = process_val.disk_usage();
let process_state = {
Expand All @@ -76,7 +76,7 @@ pub(crate) trait UnixProcessExt {
name,
command,
mem_usage_percent: if total_memory > 0 {
process_val.memory() as f64 * 100.0 / total_memory as f64
(process_val.memory() as f64 * 100.0 / total_memory as f64) as f32
} else {
0.0
},
Expand Down Expand Up @@ -114,7 +114,7 @@ pub(crate) trait UnixProcessExt {
*cpu_usages.get(&process.pid).unwrap()
} else {
*cpu_usages.get(&process.pid).unwrap() / num_processors
};
} as f32;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/data_harvester/processes/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn sysinfo_process_data(
pcu / cpu_usage
} else {
pcu
};
} as f32;

let disk_usage = process_val.disk_usage();
let process_state = (process_val.status().to_string(), 'R');
Expand All @@ -76,7 +76,7 @@ pub fn sysinfo_process_data(
process_val.memory() as f64 * 100.0 / total_memory as f64
} else {
0.0
},
} as f32,
mem_usage_bytes: process_val.memory(),
cpu_usage_percent: process_cpu_usage,
read_bytes_per_sec: disk_usage.read_bytes,
Expand Down

0 comments on commit d4ff38f

Please sign in to comment.