From: Rick DeNatale Date: 2006-10-27T08:02:56+09:00 Subject: Re: simple math question On 10/26/06, M. Edward (Ed) Borasky wrote: > Paul Lutus wrote: > > Rick DeNatale wrote: > > > > / ... > > > >> By the way, is the actual meaning of user, system, total, and real > >> documented anywhere. I've looked around a few times, and haven't > >> uncovered it. I guess I could try to devine it by reading the code > >> for benchmark, but... > > > > System time is time spent outside userspace, e.g. direct kernel calls. > > User time is time spent directly executing user code in userspace. > > > > I think total time and real time are self-explanatory, but just in case ... > > total time is system + user + kernel overhead not properly accounted for, > > and real time is simply an RTC measurement at the end of the process life > > subtracted from the same at the beginning. It is expected (in a manner of > > speaking) that none of these quantities will add as one would expect. > > > > I actually dug into this a few weeks ago for the RHEL 3 version of the > 2.4.21 Linux kernel. It's mildly complicated and changes from version to > version of the Linux kernel, especially the scheduler. And the external > tools don't always "do the right thing" either. And I *only* looked at > Linux; I'm not in possession of the same information for BSD or MacOS. I > can probably track it down for Windows, however -- it's documented in > Mark Friedman's book in the Windows 2003 Server Resource Kit. > > M. Edward "That Guy" Borasky > > P.S.: Paul's response is essentially correct and "close enough for all > practical purposes". I get paid to care about the cases when it isn't. :) > Thanks guys, I figured that it was something like that. I looked at the source code for benchmark and it's just getting Process.times before and after the block. That said, I wonder what these presumably purely computational blocks are doing in the kernel at all. In a way that's why I wasn't sure, in the context of ruby benchmarking I was sort of hoping that it was differentiating between library C code and ruby code, but it really isn't. I guess that the system time must be spent in something like process switching overhead, yes? -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/