3

I tried to measure the time of some operations on the telosB platform. For that I wanted to count the clock ticks of the processor with the clock() function from time.h but it does not compile on contiki. Are there mechanisms to measure passed time, preferably in actual clock ticks, on contiki?

Regards

schande
  • 576
  • 12
  • 27

1 Answers1

2

The latest timer documentation is here: https://github.com/contiki-ng/contiki-ng/wiki/Documentation:-Timers

You can use the clock_ticks() function. However, the resolution of those is quite low (1/128 of second). If you want measure shorter time intervals, use rtimers: RTIMER_NOW() returns the time as 16-bit integer, with platform-specific resolution. On most platforms the rtimer clock has 32678 ticks per second, but on CC26xx/CC13xx platforms it has 65536 ticks per second.

See also: Contiki difference between RTIMER_NOW() and clock_time()

kfx
  • 8,136
  • 3
  • 28
  • 52