libFirm 1.20
libfirm/timing.h File Reference

platform neutral timing utilities More...

#include <stdlib.h>
#include "begin.h"
#include "end.h"

Go to the source code of this file.

Typedefs

typedef struct ir_timer_t ir_timer_t
 A timer.

Functions

int ir_timer_enter_high_priority (void)
 Switch to real-time scheduling.
int ir_timer_leave_high_priority (void)
 Leave the high priority mode.
size_t ir_get_heap_used_bytes (void)
 Returns the amount of bytes allocated on the heap.
ir_timer_tir_timer_new (void)
 Create a new timer.
void ir_timer_free (ir_timer_t *timer)
 free memory occupied by a timer
void ir_timer_start (ir_timer_t *timer)
 Start a timer.
void ir_timer_reset_and_start (ir_timer_t *timer)
 Reset a timer and start it.
void ir_timer_reset (ir_timer_t *timer)
 Reset a timer.
void ir_timer_stop (ir_timer_t *timer)
 Stop a timer.
int ir_timer_push (ir_timer_t *timer)
 Push a timer of the timer stack.
ir_timer_tir_timer_pop (void)
 Pop the current timer.
unsigned long ir_timer_elapsed_msec (const ir_timer_t *timer)
 Returns the number of milliseconds, the timer has elapsed.
unsigned long ir_timer_elapsed_usec (const ir_timer_t *timer)
 Returns the number of microseconds, the timer has elapsed.

Detailed Description

platform neutral timing utilities

Definition in file timing.h.


Typedef Documentation

typedef struct ir_timer_t ir_timer_t

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:
timerThe timer.
Returns:
The number of milliseconds the timer is (was) running.
unsigned long ir_timer_elapsed_usec ( const ir_timer_t timer)

Returns the number of microseconds, the timer has elapsed.

Parameters:
timerThe timer.
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.
void ir_timer_free ( ir_timer_t timer)

free memory occupied by a timer

Parameters:
timerThe timer
int ir_timer_leave_high_priority ( void  )

Leave the high priority mode.

See also:
ir_timer_enter_high_priority()
Returns:
0 on success, else UNIX error code.
ir_timer_t* ir_timer_new ( void  )

Create a new timer.

Returns:
The timer.
See also:
ir_timer_t
ir_timer_t* ir_timer_pop ( void  )

Pop the current timer.

This automatically stops it and start the timer that is now on the stack.

Returns:
the popped timer
int ir_timer_push ( ir_timer_t timer)

Push a timer of the timer stack.

This automatically stop the previous timer on tos and start the new one.

Parameters:
timerThe timer to push on stack.
Returns:
non-zero on succes, zero if the timer is already on the stack.
void ir_timer_reset ( ir_timer_t timer)

Reset a timer.

Parameters:
timerThe timer.
void ir_timer_reset_and_start ( ir_timer_t timer)

Reset a timer and start it.

Parameters:
timerThe timer.
void ir_timer_start ( ir_timer_t timer)

Start a timer.

Parameters:
timerThe timer.
void ir_timer_stop ( ir_timer_t timer)

Stop a timer.

Stopping a stopped timer has no effect.

Parameters:
timerThe timer.