lkml.org 
[lkml]   [2010]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectDrift when measuring time using add_timer
    From
    Hello All,

    I am testing the timers on a OMAP4 based board. I am seeing a drift or
    the time difference between the timer value and when the function callback
    happens. This drift is around 1000ms or 1s for a expiry value of >=5mins.
    Is the time drift expected? Is this way of measuring right or is there
    any other way?

    OMAP4 as you may know is a multi-core processor and CONFIG_SMP is enabled
    along with the following:
    CONFIG_NO_HZ, CONFIG_HIGH_RES_TIMERS

    My kernel configurations:
    kernel: 2.6.37-rc7 (commit id: ffc96d)
    config: omap2plus_defconfig

    My driver does the following:

    struct timeval tv;
    test_timer_proc_write()
    {
    del_timer_sync(&my_timer);
    period = 300000; /* 5min */
    my_timer.expires = jiffies + msecs_to_jiffies(period);
    my_timer.function = func_timeout; /* Call back function*/
    /* Save the current time in global variable */
    do_gettimeofday(&timeval);
    /* add timer with an expiry value of 5mins*/
    add_timer(&my_timer);
    }

    /* Get the current time and print the difference between the two values */
    func_timeout()
    {
    struct timeval tv1;
    do_gettimeofday(&tv);
    /* take the difference between current time and saved time */
    ms = (tv.tv_sec - tv1.tv_sec) * 1000 + \
    (tv.tv_usec - tv1.tv_usec) / 1000;
    printk("Interval = %d\n", ms);
    }

    Thanks for your time.

    Regards,
    Mohan


    \
     
     \ /
      Last update: 2010-12-28 13:07    [W:0.019 / U:153.984 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site