Re: posix-cpu-timers revamp



On Fri, 2008-03-21 at 00:18 -0700, Roland McGrath wrote:
I think I misled you about the use of the it_*_expires fields, sorry.
The task_struct.it_*_expires fields are used solely as a cache of the
head of cpu_timers[]. Despite the poor choice of the same name, the
signal_struct.it_*_expires fields serve a different purpose. For an
analogous cache of the soonest timer to expire, you need to add new
fields. The signal_struct.it_{prof,virt}_{expires,incr} fields hold
the setitimer settings for ITIMER_{PROF,VTALRM}. You can't change
those in arm_timer. For a quick cache you need a new field that is
the sooner of it_foo_expires or the head cpu_timers[foo] expiry time.

Actually, after looking at the code again and thinking about it a bit,
it appears that the signal_struct.it_*_incr field holds the actual
interval as set by setitimer. Initially the it_*_expires field holds
the expiration time as set by setitimer, but after the timer fires the
first time that value becomes <firing time>+it_*_incr. In other words,
the first time it fires at the value set by setitimer() but from then on
it fires at a time indicated by whatever the time was the last time the
timer fired plus the value in it_*_incr. This time is stored in
signal_struct.it_*_expires.

I guess I could be wrong about this, but it appears to be what the code
is doing. If my analysis is correct, I really don't need a new field,
since the old fields work just fine.
--
Frank Mayhar <fmayhar@xxxxxxxxxx>
Google, Inc.

--
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

  • Re: posix-cpu-timers revamp
    ... Tests with a process CPU timer set for a long expiration time. ... interval as set by setitimer. ... the first time it fires at the value set by setitimerbut from then on ... The current value of an itimer is a user feature, ...
    (Linux-Kernel)
  • Re: Timed execution in eval
    ... If you use evala lot, you will have a SLOW program. ... the only way for a Python program to ... You then monitor the elapsed time, and when the timer ... Or you could use setitimer. ...
    (comp.lang.python)
  • Problem with Timer firing reliably
    ... I have an app that runs 24/7. ... timer that runs with its interval set to 1000 ms. ... Every time it fires, ... I display the time on the main screen using this statement: ...
    (microsoft.public.vb.general.discussion)
  • Re: A special (?) type of timer
    ... I'm not sure if there are any classes in the framework that will do that. ... I assume there is some unmanaged API that you can use ... instead, or you could try using a System.Threading.Timer with a 1 hour interval, for example, and after it fires each time check the ... I need to tell the timer: fire at 3:25 pm. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: timer/threading
    ... the timer (via SyncContext) fires on the UI thread. ... which immediately does a BeginInvoke back to the UI ...
    (microsoft.public.dotnet.languages.csharp)