platform neutral timing utilities
More...
#include <stdlib.h>
#include "begin.h"
#include "end.h"
Go to the source code of this file.
Detailed Description
platform neutral timing utilities
Definition in file timing.h.
Typedef Documentation
A timer.
A timer can be started/stopped multiple times and measures the (wallclock) time spent between start and stop calls.
Definition at line 37 of file timing.h.
Function Documentation
size_t ir_get_heap_used_bytes |
( |
void |
| ) |
|
Returns the amount of bytes allocated on the heap.
- Returns
- The number of bytes allocated on the heap.
unsigned long ir_timer_elapsed_msec |
( |
const ir_timer_t * |
timer | ) |
|
Returns the number of milliseconds, the timer has elapsed.
- Parameters
-
- Returns
- The number of milliseconds the timer is (was) running.
double ir_timer_elapsed_sec |
( |
const ir_timer_t * |
timer | ) |
|
Returns the number of seconds, the timer has elapsed.
unsigned long ir_timer_elapsed_usec |
( |
const ir_timer_t * |
timer | ) |
|
Returns the number of microseconds, the timer has elapsed.
- Parameters
-
- Returns
- The number of milliseconds the timer is (was) running.
int ir_timer_enter_high_priority |
( |
void |
| ) |
|
Switch to real-time scheduling.
This shall make measurements more precise.
- Note
- Does not work for all operating systems.
-
You could need special user privileges.
- Returns
- 0 on success, else UNIX error code.
free memory occupied by a timer
- Parameters
-
Set currently running timer as parent to timer
.
int ir_timer_leave_high_priority |
( |
void |
| ) |
|
Create a new timer.
- Returns
- The timer.
- See Also
- ir_timer_t
Pop the current timer.
This automatically stops it and start the timer that is now on the stack.
- Returns
- the popped timer
Push a timer of the timer stack.
This automatically stop the previous timer on tos and start the new one.
- Parameters
-
timer | The timer to push on stack. |
- Returns
- non-zero on succes, zero if the timer is already on the stack.
Reset a timer.
- Parameters
-
void ir_timer_reset_and_start |
( |
ir_timer_t * |
timer | ) |
|
Reset a timer and start it.
- Parameters
-
Start a timer.
- Parameters
-
Stop a timer.
Stopping a stopped timer has no effect.
- Parameters
-