Is there any way to measure more accurate time then clock() or clock_gettime() can offer ?
I checked with clock_getres() and got resolution 999847ns (~1ms). I need 50us or better resolution.
Or maybe there is another way to measure time ?
Thanks
Is there any way to measure more accurate time then clock() or clock_gettime() can offer ?
I checked with clock_getres() and got resolution 999847ns (~1ms). I need 50us or better resolution.
Or maybe there is another way to measure time ?
Thanks
ClockCycles() is your savior. A little more trouble because you need to calculate a divider taken from the CPU clock obtained with SYSPAGE_ENTRY(qtime)->cycles_per_sec
I do it this way:
ratio = 1.0 / SYSPAGE_ENTRY(qtime)->cycles_per_sec;
And then to get time in seconds.
now = ClockCycles() * ratio;
Thank You Mario
[code]uint64_t RX_VisoClock, RX_start_time, RX_end_time,cpus;
…
ThreadCtl(_NTO_TCTL_RUNMASK, (void*)(0x01));
…
RX_start_time = ClockCycles();
TimerTimeout( CLOCK_REALTIME,_NTO_TIMEOUT_INTR, NULL, &IntTimeOut, NULL );
status=InterruptWait (0, NULL);
RX_end_time = ClockCycles();
…
cpus = (SYSPAGE_ENTRY(qtime)->cycles_per_sec)/1000000;
RX_VisoClock = (RX_end_time - RX_start_time)/cpus;
printf(".. Received new data in :%llu [us] \n",RX_VisoClock);[/code]
And resolution is even better then I thought.