Skip to content

Commit

Permalink
Increase precision of process CPU usage
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Jul 15, 2021
1 parent c31f1d3 commit 5be4b73
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 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
@@ -1,6 +1,6 @@
[package]
name = "gmsv_serverstat"
version = "0.1.1"
version = "0.1.2"
authors = ["William Venner <william@venner.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion src/sysinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub unsafe extern "C-unwind" fn system_available_memory(lua: lua::State) -> i32

pub unsafe extern "C-unwind" fn process_cpu_usage(lua: lua::State) -> i32 {
fn update_cpu_usage(cpu_usage: &mut f64, process: &Process) {
*cpu_usage = (process.cpu_usage() / (*LOGICAL_CPUS as f32)) as f64;
*cpu_usage = (process.cpu_usage() as f64) / (*LOGICAL_CPUS as f64);
}

thread_local! {
Expand Down

0 comments on commit 5be4b73

Please sign in to comment.