[TEST/REVIEW] CPU accounting patches
if at hetzner.co.za
Wed Jan 25 05:09:25 PST 2006
"Poul-Henning Kamp" wrote:
> In message <20060125114544.edawx42obkkos0ck at netchild.homeip.net>, Alexander L
> dinger writes:
> >> That way, the user/system time reported will get units of "cpu seconds
> >> if the cpu ran full speed".
> >How large do you expect the error will be?
> I don't consider it an error, I consider it increasing precision.
> If you run
> time mycommand
> on your laptop, and along the way the CPU clock ramps up from
> 75 MHz to 600 MHz before it reports
> user 2.01 sys 0.30 real 4.00
> What exactly have you learned from the first two numbers with the
> current definition of "cpu second" ?
"One second's worth of the computer's processing time, which is
based on actual machine cycles used, not calendar time." ?
Is the getrusage() manual page out of date? It claims that user
and system time is is "the total amount of time spent executing in
user mode" and "the total amount of time spent in the system executing
on behalf of the process(es)".
> With my definition you would be more likely to see lower numbers
> user 0.20 sys 0.03 real 4.00
> And they would have meaning, they should be pretty much the same
> no matter what speed your CPU runs at any instant in time.
For how much of those 4 real seconds was the computer doing something
else using your definition? It's certainly not 3.77. It's probably
closer to 1.69.
> In theory, it should be possible to compare user/sys numbers
> you collect while running at 75 MHz with the ones you got
> under full steam at 1600 MHz.
If my CPU clock runs slower for a period of time, processes remain
on the CPU for longer. I don't really see how 0.23 [wallclock]
seconds _if_ the cpu ran [at] full speed is different to 2.31
wallclock seconds in this context. One is scaled to maximum CPU
clock frequency and the other is scaled to wallclock time.
I find the wallclock scale a bit less confusing because I normally
exist in that scale: on my two hypothetical identical servers, one
clocked down to 50% for some reason, the same job takes twice the
wallclock time but identical CPU time?
1. It would be nice to say to my boss that this project would have
taken a week if I'd worked faster and get a fat bonus because I
could have done it faster.
More information about the freebsd-current