[riot-devel] vtimer implementation

Kaspar Schleiser kaspar at schleiser.de
Wed Aug 21 16:35:39 CEST 2013


On 08/21/2013 03:53 PM, Milan Babel wrote:
> * vtimer is not tickless (through long_term)
When I hacked vtimer together, I tried to make the code usable also on 
platforms with 16bit timers. With any decent resolution, I had to build 
everything around using at least two ints for holding the timer values.

I also thought that the virtual timer implementation should scale timers 
to longer periods (days, weeks?), maintaining a high resolution.
Might be stupid.

> I would prefer to not use long_term updates at the behavior it is used
> now. I would suggest to only use a long_term update before the hwtimer
> overflows.
You mean, tick on overflow? I remember trying that and running into 

I decided to use seconds + µs as timer variables (for the API) as all my 
use cases were like "wait n µs", never "wait n timer ticks at resolution A".

I chose to "tick" long_term updates in full seconds as I did not find a 
nice way to map the API to timer ticks back then.

I remember trying to avoid any kind of division or modulo (other than 
powers of two), as these operations are very expensive on most 
platforms. But that made some things really messy where you'd usually 
just do "ticks = microsecs / MICROSECONDS_PER_TICK"...


More information about the devel mailing list