mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 00:43:33 +01:00
Fix ps sys units (#2967)
* Fix the units for sys and ps * Better conversion
This commit is contained in:
parent
52dc04a35a
commit
b692ca7896
@ -35,8 +35,11 @@ pub async fn ps(tag: Tag, long: bool) -> Result<Vec<Value>, ShellError> {
|
||||
"cpu",
|
||||
UntaggedValue::decimal_from_float(process.cpu_usage() as f64, tag.span),
|
||||
);
|
||||
dict.insert_untagged("mem", UntaggedValue::filesize(process.memory()));
|
||||
dict.insert_untagged("virtual", UntaggedValue::filesize(process.virtual_memory()));
|
||||
dict.insert_untagged("mem", UntaggedValue::filesize(process.memory() * 1000));
|
||||
dict.insert_untagged(
|
||||
"virtual",
|
||||
UntaggedValue::filesize(process.virtual_memory() * 1000),
|
||||
);
|
||||
|
||||
if long {
|
||||
if let Some(parent) = process.parent() {
|
||||
|
@ -100,10 +100,10 @@ pub fn mem(sys: &mut System, tag: Tag) -> Option<UntaggedValue> {
|
||||
let total_swap = sys.get_total_swap();
|
||||
let free_swap = sys.get_free_swap();
|
||||
|
||||
dict.insert_untagged("total", UntaggedValue::filesize(total_mem));
|
||||
dict.insert_untagged("free", UntaggedValue::filesize(free_mem));
|
||||
dict.insert_untagged("swap total", UntaggedValue::filesize(total_swap));
|
||||
dict.insert_untagged("swap free", UntaggedValue::filesize(free_swap));
|
||||
dict.insert_untagged("total", UntaggedValue::filesize(total_mem * 1000));
|
||||
dict.insert_untagged("free", UntaggedValue::filesize(free_mem * 1000));
|
||||
dict.insert_untagged("swap total", UntaggedValue::filesize(total_swap * 1000));
|
||||
dict.insert_untagged("swap free", UntaggedValue::filesize(free_swap * 1000));
|
||||
|
||||
Some(dict.into_untagged_value())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user