Skip to content
Snippets Groups Projects
Unverified Commit 55fd7dff authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Add centiseconds to context time

parent e5c3be86
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ use crate::context; ...@@ -5,7 +5,7 @@ use crate::context;
use crate::syscall::error::Result; use crate::syscall::error::Result;
pub fn resource() -> Result<Vec<u8>> { pub fn resource() -> Result<Vec<u8>> {
let mut string = format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<8}{:<8}{}\n", let mut string = format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<12}{:<8}{}\n",
"PID", "PID",
"PGID", "PGID",
"PPID", "PPID",
...@@ -17,7 +17,7 @@ pub fn resource() -> Result<Vec<u8>> { ...@@ -17,7 +17,7 @@ pub fn resource() -> Result<Vec<u8>> {
"ENS", "ENS",
"STAT", "STAT",
"CPU", "CPU",
"TICKS", "TIME",
"MEM", "MEM",
"NAME"); "NAME");
{ {
...@@ -63,12 +63,14 @@ pub fn resource() -> Result<Vec<u8>> { ...@@ -63,12 +63,14 @@ pub fn resource() -> Result<Vec<u8>> {
format!("?") format!("?")
}; };
let cpu_time = context.cpu_time / crate::time::NANOS_PER_SEC; let cpu_time_s = context.cpu_time / crate::time::NANOS_PER_SEC;
let cpu_time_ns = context.cpu_time % crate::time::NANOS_PER_SEC;
let cpu_time_string = format!( let cpu_time_string = format!(
"{:02}:{:02}:{:02}", "{:02}:{:02}:{:02}.{:02}",
cpu_time / 3600, cpu_time_s / 3600,
(cpu_time / 60) % 60, (cpu_time_s / 60) % 60,
cpu_time % 60 cpu_time_s % 60,
cpu_time_ns / 10_000_000
); );
let mut memory = context.kfx.len(); let mut memory = context.kfx.len();
...@@ -93,7 +95,7 @@ pub fn resource() -> Result<Vec<u8>> { ...@@ -93,7 +95,7 @@ pub fn resource() -> Result<Vec<u8>> {
format!("{} B", memory) format!("{} B", memory)
}; };
string.push_str(&format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<9}{:<8}{}\n", string.push_str(&format!("{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<6}{:<12}{:<8}{}\n",
context.id.into(), context.id.into(),
context.pgid.into(), context.pgid.into(),
context.ppid.into(), context.ppid.into(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment