I know the default eCos precision is 1 ticks = 10 ms
.
And eCos OS provide cyg_current_time();
I can use cyg_current_time divide the tick_per_one_ms to get SystemTime_MS;
(e.g.) GetSystemTime = cyg_current_time() / 10;
How can I get System time with us precision ?
I want to calculate one time interval for us precision.
For example(Want to know how much time that A() cost):
startTime = GetSystemTimeUS();
A();
endTime = GetSystemTimeUS();
printf("A() cost %lu us.",endTime - startTime);
I have tried many method, but it didn't work.
- gettimeofday: it seams that eCos implement, but it still ms precision.
- get tick: but 1 tick is 10ms. it means that context switching time is ms precision.
- timer, clock , etc....
What I mean is that I want to implement a get Current System time function with us precision.