Hi, --- tyler@xxxxxxxx escreveu: > On Thu, Apr 27, 2006 at 09:49:39PM +0000, Mauricio Lin wrote: > > Hi all, > > > > Since sched_clock() function is implemented differently for each > arch, > > how can I figure out the maximum value sched_clock can return? > > > > As sched_clock() has its return value reset to zero when the > maximum > > value is reached, how can i get the maximum value supported by a > > certain arch? > > > > BR, > > > > Mauricio Lin. > Hi, > > have a look at the definition of the function. The i386 one can be > found > here : > > http://sosdg.org/~coywolf/lxr/source/arch/i386/kernel/timers/timer_tsc.c#L150 > > The prototype of the function is : > unsigned long long sched_clock(void); > > This means that the maximum number returned by the sched_clock > function > is 2^64 - 1 This is not true for all sched_clock() implementation since the maximum value returned by sched_clock() depends the timer and clock available in different archs. For instance, in arch/arm/mach-realview/core.c (see below) the maximum value returned by sched_clock() is about 179*10^9 nanoseconds according to the code comments. But I need to verify precisely the maximum value returned by sched_clock() since the comments just say a rough (not quite exact) maximum value. /* * This is the RealView sched_clock implementation. This has * a resolution of 41.7ns, and a maximum value of about 179s. */ unsigned long long sched_clock(void) { unsigned long long v; v = (unsigned long long)readl(REALVIEW_REFCOUNTER) * 125; do_div(v, 3); return v; } If we assume roughly 179 seconds is the maximum value, the value in nanoseconds should be 179*10^9, but it is important on my task to verify precisely if the maximum value is such value or something close to this value. So assume the maximum value is 2^64 - 1 does not make sense in this case, since 2^64 is much higher than 179*10^9. BR, Mauricio Lin. _______________________________________________________ Navegue com o Yahoo! Acesso Grátis, assista aos jogos do Brasil na Copa e ganhe prêmios de hora em hora! http://br.yahoo.com/artilheirodacopa/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/