lkml.org 
[lkml]   [2015]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] cputime: Make the reported utime+stime correspond to the actual runtime.
On Tue, Jul 07, 2015 at 10:09:13AM +0200, Peter Zijlstra wrote:
> On Tue, Jul 07, 2015 at 09:59:54AM +0200, Peter Zijlstra wrote:
> > > > + /*
> > > > + * Make sure stime doesn't go backwards; this preserves monotonicity
> > > > + * for utime because rtime is monotonic.
> > > > + *
> > > > + * utime_i+1 = rtime_i+1 - stime_i
> > > > + * = rtime_i+1 - (rtime_i - stime_i)
> > > > + * = (rtime_i+1 - rtime_i) + stime_i
> > > > + * >= stime_i
> > > > + */
>
> Argh, just noticed I messed that up, it should read:
>
> + /*
> + * Make sure stime doesn't go backwards; this preserves monotonicity
> + * for utime because rtime is monotonic.
> + *
> + * utime_i+1 = rtime_i+1 - stime_i
> + * = rtime_i+1 - (rtime_i - utime_i)
> + * = (rtime_i+1 - rtime_i) + utime_i
> + * >= utime_i
> + */
>
> I got some [us] confusion. Typing is hard.
>
> So we compute: utime = rtime - stime, which we'll denote as:
>
> utime_i+1 = rtime_i+1 - stime_i

But I don't get how you come to that.

Imagine the following rounds:

utime:2 stime:2 rtime:4 --> prev->utime = 2 prev->stime = 2

utime:2 stime:6 rtime:8 --> prev->utime = 2 prev->stime = 6

So here if I apply your above formula we have:

utime_i+1:2 = rtime_i+1:8 - stime_i:2

Which doesn't work, so probably I still misunderstand those _i things...


\
 
 \ /
  Last update: 2015-07-07 15:41    [W:0.121 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site