Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
kernel
Commits
55fd7dff
Unverified
Commit
55fd7dff
authored
2 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Add centiseconds to context time
parent
e5c3be86
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheme/sys/context.rs
+10
-8
10 additions, 8 deletions
src/scheme/sys/context.rs
with
10 additions
and
8 deletions
src/scheme/sys/context.rs
+
10
−
8
View file @
55fd7dff
...
@@ -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"
,
"TI
CKS
"
,
"TI
ME
"
,
"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
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment