mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Fix the unit of meminfo
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
ae02eb227d
commit
aa5bc6ff73
@ -40,9 +40,13 @@ fn mem_available() -> usize {
|
|||||||
|
|
||||||
impl FileOps for MemInfoFileOps {
|
impl FileOps for MemInfoFileOps {
|
||||||
fn data(&self) -> Result<Vec<u8>> {
|
fn data(&self) -> Result<Vec<u8>> {
|
||||||
let total = mem_total();
|
let total = mem_total() / 1024;
|
||||||
let available = mem_available();
|
let available = mem_available() / 1024;
|
||||||
let output = format!("MemTotal:\t{}\nMemAvailable:\t{}\n", total, available);
|
let free = total - available;
|
||||||
|
let output = format!(
|
||||||
|
"MemTotal:\t{} kB\nMemFree:\t{} kB\nMemAvailable:\t{} kB\n",
|
||||||
|
total, free, available
|
||||||
|
);
|
||||||
Ok(output.into_bytes())
|
Ok(output.into_bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user