mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-12-08 14:03:51 +00:00
parse /proc/meminfo for memory usage (#7)
* fix: calculate memory usage via /proc/meminfo * refactor: move sysinfo call into get_current No longer used by anything but uptime.
This commit is contained in:
parent
4d509839f5
commit
1cf4f754ac
3 changed files with 26 additions and 17 deletions
|
|
@ -1,8 +1,9 @@
|
|||
use color_eyre::Result;
|
||||
use nix::sys::sysinfo::SysInfo;
|
||||
use nix::sys::sysinfo::sysinfo;
|
||||
use std::io;
|
||||
|
||||
pub fn get_current(info: &SysInfo) -> Result<String, io::Error> {
|
||||
pub fn get_current() -> Result<String, io::Error> {
|
||||
let info = sysinfo().map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
||||
let uptime_seconds = info.uptime().as_secs_f64();
|
||||
|
||||
let total_minutes = (uptime_seconds / 60.0).round() as u64;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue