We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
In a very simple task containing an infinite loop and running on os_itv_wait() I would like to measure how long the code takes to run using os_time_get(). For example if os_itv_wait() lets my code run every 5 ticks and the difference between os_time_get() called at the top and bottom of my code is 2 ticks I know that I have time to spare. If the code takes 8 ticks I have a problem.
In my case I am running my code every 1 tick and can accept that occasionally the code runs in over 1 tick but I don't want it to take 2 ticks. Ideally therefore I'd like a sub-tick resolution timer but I haven't got that (without running a hardware timer which is a future possibility).
So for this test I'm looking to see if a whole tick has expired by the time I reach the end of the code - but this relies on the os_itv_wait() being synchronous and changing at the same time as the os_time_get() result and I don't know if they are.
For example, if os_itv_wait() allows my code to run but os_time_get() value changes 100us later I am likely to see a change between the top and bottom of my code times on every run.
I suspect that it is all driven from the same counter. A change in that counter value is synchronous with os_itv_wait() allowing my code to run and os_time_get() returning the new value.
You should probably start with something simple.
Anyone else know if this is a single counter?