Re: gettimeofday() in 2.6.24



On Thu, Apr 17, 2008 at 7:13 PM, Chris Friesen <cfriesen@xxxxxxxxxx> wrote:
Jack Harvard wrote:


http://lxr.linux.no/linux+v2.6.24/arch/arm/kernel/time.c#L240
239#ifndef CONFIG_GENERIC_TIME
240void do_gettimeofday(struct timeval *tv)
241{
242 unsigned long flags;
243 unsigned long seq;
244 unsigned long usec, sec;
245
246 do {
247 seq = read_seqbegin_irqsave(&xtime_lock, flags);
248 usec = system_timer->offset();
249 sec = xtime.tv_sec;
250 usec += xtime.tv_nsec / 1000;
251 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));




but I haven't quite figured out how gettimeofday() actually gets time
from this added timer, also how xtime is updated?



system_timer->offset() uses the added timer to return the number of usecs
since the last timer tick. It's potentially different for each specific
type of arm blade, and the function often has "gettimeoffset" in the name.


"xtime" is updated in the core kernel code.

is "xtime" updated by the time tick clock timer, i.e., the timer which
generates interrupts every 1/HZ second to the kernel. Put it in
another way,
does gettimeofday get time in two parts 1) seconds from xtime.tv_sec,
updated by timer0, 2) microseconds from xtime.tv_nsec +
system_timer->offset(), updated by timer0 and timer3.

Do you mean the code here
"http://lxr.linux.no/linux+v2.6.24/kernel/time/timekeeping.c#L45";
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Time precision, adjtime(x) vs. gettimeofday
    ... timer to provide better-than-jiffy ... The problem is that the offset added to xtime value (typically ... that is trying to slow you down a bit, and you call gettimeofday ... really added to xtime on the next interrupt. ...
    (Linux-Kernel)
  • Re: [PATCH] s390 (9/9): no timer interrupts in idle.
    ... Skipping ticks will have some really bad effects, e.g. if the xtime ... Most hardware have an alternative time source for such time stamps. ... Timer events *won't* be delivered too late, ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: gettimeofday() in 2.6.24
    ... Jack Harvard wrote: ... system_timer->offset() uses the added timer to return the number of usecs since the last timer tick. ... "xtime" is updated in the core kernel code. ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
    (Linux-Kernel)
  • Re: why cpu Frequence is Different in windows ce and xp in same pc
    ... With the 845 comes an ACPI timer whose frequency is 3 times the ... now i know that standard CEPC implementation work with timer0 1,193,182 Hz ...
    (microsoft.public.windowsce.embedded)
  • timer on pc
    ... the timer it gives some count within 65536 I do not know wheher it is ... correct.After issueing the READ BACK command it shows that timer0 is ... As i am already using timer2 i cant use it and as timer1 is ...
    (comp.arch.embedded)