clock problem
Dear all,
I am running a serial port test in xenomai (xenomai-2.5.5.2) using 16550A driver. In my program, I am calling
rt_dev_ioctl(dev_id, RTSER_RTIOC_WAIT_EVENT, & rx_event);
when an event happens, I use clock_gettime(CLOCK_MONOTONIC, & curr_time) to get the current time. The program runs continuosly in a while loop. In this way, I measure the elapsed time between the previous and current events.
For this test, I find something that I still cannot figure out. They are as follows:
1st session running the program, elapsed time between events - 40 us (reboot system) 2nd session - 80 us (reboot system) 3rd session - 150 us (reboot system) 4th session - 100 us (reboot system)
and so on.
And I use clock_getres to see the resolution of the clock, tv_sec = 0, tv_nsec = 1.
My question is - why everytime I reboot the system, I get different elapsed time measurement for the same program?
Can someone please help ?
Regards,
Ph293
Quoted 10 lines · Philip Ha
Dear all,
I am running a serial port test in xenomai (xenomai-2.5.5.2) using 16550A driver. In my program, I am calling
rt_dev_ioctl(dev_id, RTSER_RTIOC_WAIT_EVENT, & rx_event);when an event happens, I use
clock_gettime(CLOCK_MONOTONIC, & curr_time)to get the current time. The program runs continuosly in a while loop. In this way, I measure the elapsed time between the previous and current events.
Hi,
we do not have enough details here, if you are compiling for the native skin, the call to clock_gettime is linux clock_gettime, so, can not really be relied upon in a thread which you with to remain in primary mode. You should use rt_timer_read.
If you are compiling for the posix skin, you do not give us enough information to even begin understanding the issue you have .
Regards.
Signature · 1 line
Gilles.