On Thu, 12 Aug 2010 15:46:51 +0530  wrote

>>2010/8/12 prakash srinivasan 

>>

>> Deal All,

>> I am executing a simple for() loop and like to calculate the time period for 
>> this loop. I used rt_timer_read(). As per the document, it mentioned that 
>> rt_timer_read() returns the current time expressed in clock ticks. I could 
>> not able to get an clear idea about it. Suppose if i convert it by using 
>> rt_timer_ticks2ns(), I am not getting the proper output. My code is,



>> RTIME start, end;

>> ...

>> ...

>> start=rt_timer_read();

>> for()

>> {}

>> end=rt_timer_read();

>> printf(TOTAL LOOP TIMING=%ld usn", 
>> (long)((rt_timer_ticks2ns(end-start))/1000);

>>

>> I would like to convert the ticks into nano seconds first and then into 
>> micro seconds. The final result is irrelevant. I am not sure, where is the 
>> issue. Help me to find the timings details properly.



>Irrelevant how? Not repeatable?



Early I gave (long)(start). The output was in negative.



>What are the printed values?

>Did you try without rt_timer_ticks2ns first?



Output without rt_time_ticks2ns()::



printf("Starting time: %ld\n",(long)start);

Starting time: 445465374

printf("End time: %ld\n",(long)end);

End time: 927680697

printf (Difference time:%ld\n",(long)(end-start))

Difference time: 482215323



Output with rt_timer_ticks2ns()::



printf("Starting time: %ld\n",(long)rt_timer_ticks2ns(start));

Starting time: -2090279950

printf("End time: %ld\n",(long)rt_timer_ticks2ns(end));

End time: -1168915612

printf (Difference time:%ld\n",(long)rt_timer_ticks2ns(end-start))

Difference time: 921364338



whether my call is correct, (long) rt_timerticks2ns(end-start)?



-Prakash
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to