mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
Implement basic support for times().
The kernel now bills processes for time spent in kernelspace and userspace separately. The accounting is forwarded to the parent process in reap(). This makes the "time" builtin in bash work.
This commit is contained in:
parent
4bc87dc7b9
commit
e7cc08226f
10 changed files with 50 additions and 7 deletions
|
@ -181,6 +181,12 @@ bool Scheduler::context_switch(Process& process)
|
|||
process.set_ticks_left(time_slice);
|
||||
process.did_schedule();
|
||||
|
||||
if (process.tss().cs & 3) {
|
||||
++process.m_ticks_in_user;
|
||||
} else {
|
||||
++process.m_ticks_in_kernel;
|
||||
}
|
||||
|
||||
if (current == &process)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue