Re: [pure-lang-users] llvm 2.3 - good news
Status: Beta
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-07-13 17:17:29
|
Libor Spacek wrote: > I am not even sure if clock() internally does any rounding, from what I can see > it is just a discrete counter running in 10ms units, meaning that CPU time of > as much as 9ms can register as 0 (zilch). That's just what Linux's default HZ value of 100 will give you. They changed HZ to 1000 for a while, but then changed it back because it was eating too much energy on laptops. The latest kernels have tickless timers (not always enabled by default, so you might have to build your own kernel to get those), which enables you to get any resolution that you want with the POSIX highres timers (up to what the hardware provides, which is typically ~1 microsec on current systems). I'm not sure where gettimeofday gets the microsec ticks on Linux, probably it directly reads some hardware timer, but that's not guaranteed by POSIX. And since it's wallclock time it's useless for measuring performance anyway. The proper solution is to use the POSIX highres timers on systems that have them (recent Linux 2.6.x versions do). Have a look at the clock_gettime manual page, it should be easy to wrap this in Pure, or write a little C module for that purpose. (There's also code in Q's system module which could easily be ported to Pure -- see the nanotime et al routines in modules/clib/system.c in the Q sources.) HTH, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |