NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/57512: clock_gettime(CLOCK_THREAD_CPUTIME_ID) sometimes goes backwards



The following reply was made to PR kern/57512; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: conorh%sdf.org@localhost
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/57512: clock_gettime(CLOCK_THREAD_CPUTIME_ID) sometimes goes backwards
Date: Sat, 8 Jul 2023 00:18:21 +0000

 This is because CLOCK_THREAD_CPUTIME_ID is implemented by summing
 l->l_rticksum + l->l_slpticksum, but these are both reset periodically
 by sched_lwp_stats.
 
 Aside: Not sure why we add the sleeping time, l_slpticksum?
 
 I think this should probably instead use l->l_ru.ru_utime +
 l->l_ru.ru_stime, possibly with an adjustment from the timecounter
 since the last tick like calcru does for process getrusage.  But I
 would need to think more about it to be sure.
 


Home | Main Index | Thread Index | Old Index