Use actual time in monitoring loops
Current implementation of time in monitoring loops is to increase a counter by the amount of time the loop should sleep before the next iteration. This does not take into account the time for the read instruction to execute and therefore the total time of the loops would exceed the wanted duration.
For example, if the probe interval is 50ms and the internal execution time of instructions in the loop is 10ms, the total time for one loop is 60ms while the code would account this for only 50ms. Therefore, if the intended total length of the loop is 5s, the code will do 100 loops, amounting to in fact 6s.
The ending time of the loop should there be checked wrt. the beginning time for monitoring instead of loop counts.
Yet, I don't want to compensate the sleep time by the instructions execution time, which results in a lower number of loops than expected but allows to deduce the execution time from the timestamps (and avoid having to deal with negative values that would be yielded if the probe interval is lower than the actual loop execution time).