meminfo/meminfo.rs
1// Copyright (c) 2020 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
2// Use of this source is governed by Apache-2.0 License that can be found
3// in the LICENSE file.
4
5fn main() {
6 let mut info = nc::sysinfo_t::default();
7 let _ = unsafe { nc::sysinfo(&mut info) };
8
9 println!("free mem: {}", info.freeram * info.mem_unit as usize);
10 println!("total mem: {}", info.totalram * info.mem_unit as usize);
11}