On Wed, Jul 25, 2012, Oleg Goldshmidt wrote about "Re: High-resolution user/system times?": > > It appears that while times(2) has a 4-ms resolution, > > > Sanity check: I assume you measured it, right? Out of curiosity I did > > #include <unistd.h> > #include <sys/times.h> > #include <stdio.h> > > int main(void) { > return printf("%ld\n",sysconf(_SC_CLK_TCK)); > } > > on a couple of systems, and got 100 both times, which corresponds to a 10ms > resolution. This is what I'd expect if HZ is 100 in the kernel.
HZ used to default to 100 in the Linux kernel, but now it actually defaults (unless I'm mis-remembering) to 250, and this is where the 4-ms resolution came from. But the specific number - 4 or 10ms, is not what matters. The issue is that I can't get 0.1 ms resolution, unless I set HZ to 10,000, which is a completely non-standard setup. > So I gather you think this will be different from what you wanted to avoid > in your original post because you think the startup code will be repeated > on each iteration? It's difficult to assess without knowing what it is that > you are trying to measure and what, in the context, the difference is. Right. I couldn't put a loop inside the process, but starting the same process over and over would incur exactly the same overheads over and over - all the same minor page faults (note: *minor* page faults means we don't need to fetch pages from disk), and other things I suspect are happening. -- Nadav Har'El | Wednesday, Jul 25 2012, 6 Av 5772 n...@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Creativity consists of coming up with http://nadav.harel.org.il |many ideas, not just that one great idea. _______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il