#include <sys/resource.h>
#include <sys/time.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
| struct | struct_stopwatch_t |
| Defines a very basic stopwatch-like timer. More... | |
Defines | |
| #define | _TIFA_STOPWATCH_H_ |
Typedefs | |
| typedef struct struct_stopwatch_t | stopwatch_t |
Equivalent to struct struct_stopwatch_t. | |
Functions | |
| void | init_stopwatch (stopwatch_t *const watch) |
Inits a stopwatch_t. | |
| void | start_stopwatch (stopwatch_t *const watch) |
Starts a stopwatch_t. | |
| void | stop_stopwatch (stopwatch_t *const watch) |
Stop a stopwatch_t. | |
| void | reset_stopwatch (stopwatch_t *const watch) |
Reset a stopwatch_t. | |
| double | get_stopwatch_elapsed (stopwatch_t *const watch) |
| Returns the elapsed time measured. | |
rusage structure and using the getrusage function.
Definition in file stopwatch.h.
| #define _TIFA_STOPWATCH_H_ |
Standard include guard.
Definition at line 37 of file stopwatch.h.
| double get_stopwatch_elapsed | ( | stopwatch_t *const | watch | ) |
Returns the elapsed time measured.
Returns the elapsed time measured by watch in seconds.
stop_stopwatch function).| [in] | watch | The stopwatch_t used for timing. |
| void init_stopwatch | ( | stopwatch_t *const | watch | ) |
Inits a stopwatch_t.
Initializes the stopwatch_t pointed to by watch.
| watch | The stopwatch_t to init. |
| void reset_stopwatch | ( | stopwatch_t *const | watch | ) |
Reset a stopwatch_t.
Reset the stopwatch_t pointed to by watch. The stopwatch is not stopped and will continue to run unless it was already stopped.
| watch | The stopwatch_t to reset. |
| void start_stopwatch | ( | stopwatch_t *const | watch | ) |
Starts a stopwatch_t.
Starts the stopwatch_t pointed to by watch.
start_stopwatch are without effect.| watch | The stopwatch_t to start. |
| void stop_stopwatch | ( | stopwatch_t *const | watch | ) |
Stop a stopwatch_t.
Stop the stopwatch_t pointed to by watch. Successive calls to start_stopwatch and stop_stopwatch are cumulative. In other words, the stopwatch's state holds the time elapsed during all previous time intervals defined by a call to start_stopwatch followed by a call to stop_stopwatch (provided that the stopwatch was not reset with reset_stopwatch).
stop_stopwatch are without effect.| watch | The stopwatch_t to stop. |