mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
kernel/thread: Account for current run in fill_thread_info's CPU time handling.
Otherwise, if the thread is currently running, its runtime won't be included in the returned statistics.
This commit is contained in:
parent
4e392e7f44
commit
ace43da6f9
@ -1222,6 +1222,13 @@ fill_thread_info(Thread *thread, thread_info *info, size_t size)
|
||||
InterruptsSpinLocker threadTimeLocker(thread->time_lock);
|
||||
info->user_time = thread->user_time;
|
||||
info->kernel_time = thread->kernel_time;
|
||||
if (thread->last_time != 0) {
|
||||
const bigtime_t current = system_time() - thread->last_time;
|
||||
if (thread->in_kernel)
|
||||
info->kernel_time += current;
|
||||
else
|
||||
info->user_time += current;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user