[lkml]   [1997]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: About the timer in linux-kernel
    Benoit ROBINET wrote:
    > I would like to implement timers that allow to go to sleep for a shorter
    > time than a hundredth of second (which is the unit of jiffies).
    > I know I could use udelay() function, but I must say that I don't really
    > want to, because I think udelay() blocks the whole kernel when
    > working...
    > I am highly frustrated because I have a Pentium Pro 200, and I don't
    > really see how to be more accurate than hundredth of seconds...
    > Could anyone help me ?
    > Thanks, and regards
    > Benoit ROBINET

    This is my understanding (someone correct me if I am wrong):

    If you really want to go to "sleep", the smallest amount you can delay
    is one clock tick, assuming nothing else is running. On the Intel
    platform, that is 10 mS.

    You can use select() to get uS timing. I've never really eveluated the
    precision of this, but the following function does use select() that

    int delay_us(int microseconds)
    struct timeval tv;

    if( microseconds >= 1000000 )
    tv.tv_sec = microseconds % 1000000;
    tv.tv_usec = microseconds / 1000000;
    tv.tv_sec = 0;
    tv.tv_usec = microseconds;
    select (0,0,0,0,&tv); /* block 'til timeout */
    return 0;

    I'm guessing that when select blocks, you lose your timeslice. Can
    anyone tell me what this is really doing. (The program I needed this
    for works, so I've never spent any more time on it).

    Robert Wuest, PE Empowered Kemet Electronics
    Sirius Engineering Company by Linux

     \ /
      Last update: 2005-03-22 13:40    [W:0.024 / U:33.476 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site