mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Drop resident from memory usage
This commit is contained in:
parent
ad43d6bde6
commit
dae99b6661
1 changed files with 3 additions and 4 deletions
|
@ -5,7 +5,6 @@ use cfg_if::cfg_if;
|
||||||
|
|
||||||
pub struct MemoryUsage {
|
pub struct MemoryUsage {
|
||||||
pub allocated: Bytes,
|
pub allocated: Bytes,
|
||||||
pub resident: Bytes,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MemoryUsage {
|
impl MemoryUsage {
|
||||||
|
@ -14,9 +13,9 @@ impl MemoryUsage {
|
||||||
if #[cfg(target_os = "linux")] {
|
if #[cfg(target_os = "linux")] {
|
||||||
// Note: This is incredibly slow.
|
// Note: This is incredibly slow.
|
||||||
let alloc = unsafe { libc::mallinfo() }.uordblks as u32 as usize;
|
let alloc = unsafe { libc::mallinfo() }.uordblks as u32 as usize;
|
||||||
MemoryUsage { allocated: Bytes(alloc), resident: Bytes(0) }
|
MemoryUsage { allocated: Bytes(alloc) }
|
||||||
} else {
|
} else {
|
||||||
MemoryUsage { allocated: Bytes(0), resident: Bytes(0) }
|
MemoryUsage { allocated: Bytes(0) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +23,7 @@ impl MemoryUsage {
|
||||||
|
|
||||||
impl fmt::Display for MemoryUsage {
|
impl fmt::Display for MemoryUsage {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(fmt, "{} allocated {} resident", self.allocated, self.resident,)
|
write!(fmt, "{}", self.allocated)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue