[lkml]   [2003]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: getting timestamp of last interrupt?
    On Mon, 6 Oct 2003, Hans-Georg Thien wrote:

    > Richard B. Johnson wrote:
    > > On Sat, 4 Oct 2003, Hans-Georg Thien wrote:
    > >
    > >
    > >>> [...]
    > >>>>I am looking for a possibility to read out the last timestamp when an
    > >>>>interrupt has occured.
    > >>>>
    > >>>>e.g.: the user presses a key on the keyboard. Where can I read out the
    > >>>>timestamp of this event?
    > >>>
    > >>>
    > >>>You can get A SIGIO signal for every keyboard, (or other input) event.
    > >>>What you do with it is entirely up to you. Linux/Unix doesn't have
    > >>>"callbacks", instead it has signals. It also has select() and poll(),
    > >>>all useful for handling such events. If you want a time-stamp, you
    > >>>call gettimeofday() in your signal handler.
    > >>>
    > >>
    > >>Thanks a lot Richard,
    > >>
    > >>... but ... can I use signals in kernel mode?
    > >
    > >
    > > Well you talked about the user pressing a key and getting
    > > a time-stamp as a result. If you need time-stamps
    > > inside the kernel, i.e, a module, then you can call
    > > the kernel's do_gettimeofday() function.
    > >
    > Hello Richard, - It seems, that I should be more precise about what I
    > exactly mean...
    > I'm writing a kernel mode device driver (mouse).
    > In that device driver I need the timestamp of the last event for another
    > kernel mode device (keyboard).
    > I do not care if that timestamp is in jiffies or in gettimeofday()
    > format or whatever format does exist in the world. I am absolutely sure
    > I can convert it somehow to fit my needs.
    > But since it is a kernel mode driver it can not -AFAIK- use the signal()
    > syscall.
    > -Hans

    Then it gets real simple. Just use jiffies, if you can stand the
    wrap that will occur every (2^32 -1)/HZ seconds ~= 497 days with
    HZ = 100. If not, call sys_gettimeofday(). Also, if your events
    are closer in time than a HZ, then you must get time from

    Dick Johnson
    Penguin : Linux version 2.4.22 on an i686 machine (797.90 BogoMips).
    Note 96.31% of all statistics are fiction.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:49    [W:0.022 / U:6.696 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site