High-resolution user/system times?

High-resolution user/system times?

Oleg Goldshmidt pub at goldshmidt.org
Wed Jul 25 11:25:35 IDT 2012


On Wed, Jul 25, 2012 at 11:15 AM, Nadav Har'El <nyh at math.technion.ac.il>wrote:

> On Wed, Jul 25, 2012, Oleg Goldshmidt wrote about "Re: High-resolution
> user/system times?":
> > > Hi, as you know the time(1) command, and the times(2) system call is
> > > able to separate a process's running time into "user" and "system"
> time,
> > > measuring the CPU time in user space and kernel space respectively.
> > >
> > > However, these only have a jiffy (often 1/250 seconds) resultion.
> >...
> >
> > man 2 getrusage ?
>
> Thanks.
>
> The manual page seems promising, talking about microseconds, but I don't
> believe it actually has a microsecond resolution. I think it has the
> same jiffy resolution that times() has. Do you believe that it does
> have microsecond resolution?
>

No, I know it doesn't. Actually, I looked the kernel code up, I do think
that HZ is 100 (by default), and jiffies_to_usecs is faking it.

Maybe you need to resort to clock_gettime with CLOCK_REALTIME. Some
mentioned related instrumentation earlier in this thread.


> I think we're starting to build here a long list of manual-page bugs...
>
> --
> Nadav Har'El                        |        Wednesday, Jul 25 2012, 6 Av
> 5772
> nyh at math.technion.ac.il
> |-----------------------------------------
> Phone +972-523-790466, ICQ 13349191 |Evening news begins with 'Good
> evening',
> http://nadav.harel.org.il           |and then proceeds to say why it
> isn't.
>



-- 
Oleg Goldshmidt | oleg at goldshmidt.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20120725/a686abd7/attachment.html>


More information about the Linux-il mailing list