Go to file
Thomas Lamprecht cfae8ae3d2 linux/procfs: add read_proc_stat
For now we just parse the CPU "time-spent" counters and calculate the
CPU usage of the whole system. As we do not want a total average we
use a state-full implementation, which calculates the usage since the
last request (if older than 1 second).

Somewhat modeled after our Perl version of this. But for the "total"
we do not use the:
> ($ctime - $last_proc_stat->{ctime}) * $clock_ticks * $cpucount;
calculation, but just add _all_ fields together, as that is the total
of CPU time.

Use a Reader-Writer lock to sync updating. First check under the
reader lock if the data is recent enough, else update it under the
writer lock.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-18 17:00:51 +01:00
proxmox updates for hyper 0.13 release 2019-12-12 13:13:53 +01:00
proxmox-api formatting fixup 2019-12-18 13:20:58 +01:00
proxmox-api-macro formatting fixup 2019-12-18 13:20:58 +01:00
proxmox-sortable-macro sortable-macro: fixup handle_error 2019-11-26 14:20:30 +01:00
proxmox-sys linux/procfs: add read_proc_stat 2019-12-18 17:00:51 +01:00
proxmox-tools cleanup 2019-12-18 13:41:17 +01:00
.gitignore import Cargo.lock 2019-08-09 08:44:48 +02:00
Cargo.toml delete the old api macro stuff 2019-11-21 13:13:18 +01:00
Makefile run 'cargo fmt -- --check' in check target 2019-11-25 15:08:53 +01:00
rust-toolchain update toolchain to stable 2019-11-08 11:51:21 +01:00
rustfmt.toml initial import, starting with vec & io helpers 2019-06-06 14:00:25 +02:00