JWS C Library
C language utility library
time.h File Reference

Utility functions to track process time. More...

#include <jwsc/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/times.h>
Include dependency graph for time.h:

Go to the source code of this file.

Data Structures

struct  Timer
 Timer structure. More...

Functions

void start_timer (Timer *t)
 Starts the timer by initializing it to the current process time.
void stop_timer (Timer *t)
 Stops the timer by differencing a started timer with the current process time.
void add_time_to_timer (Timer *t_1, const Timer *t_2)
 Adds time from one timer to another.
void zero_timer (Timer *t)
 Initializes a timer to zero.
user_time

Returns the user time of a Timer.

double user_time_s (const Timer *t)
 Returns the user time in seconds.
double user_time_ms (const Timer *t)
 Returns the user time in milliseconds.
sys_time

Returns the system time of a Timer.

double sys_time_s (const Timer *t)
 Returns the system time of a Timer in seconds.
double sys_time_ms (const Timer *t)
 Returns the system time of a Timer in milliseconds.
proc_user_time

Returns the current ellapsed process user time.

double proc_user_time_s ()
 Returns the current ellapsed process user time in seconds.
double proc_user_time_ms ()
 Returns the current ellapsed process user time in milliseconds.
proc_sys_time

Returns the current ellapsed process system time.

double proc_sys_time_s ()
 Returns the current ellapsed process system time in seconds.
double proc_sys_time_ms ()
 Returns the system time of a Timer in milliseconds.

Detailed Description

Utility functions to track process time.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file time.h.


Function Documentation

void start_timer ( Timer t)

Starts the timer by initializing it to the current process time.

Parameters:
tTimer structure to initialize.

Definition at line 60 of file time.c.

void stop_timer ( Timer t)

Stops the timer by differencing a started timer with the current process time.

Parameters:
tTimer structure to stop.

Definition at line 69 of file time.c.

void add_time_to_timer ( Timer t_1,
const Timer t_2 
)

Adds time from one timer to another.

Parameters:
t_1Timer to add to.
t_2Timer to add from.

Definition at line 86 of file time.c.

void zero_timer ( Timer t)

Initializes a timer to zero.

Parameters:
tTimer to zero.

Definition at line 96 of file time.c.

double user_time_s ( const Timer t)

Returns the user time in seconds.

Definition at line 112 of file time.c.

double user_time_ms ( const Timer t)

Returns the user time in milliseconds.

Definition at line 118 of file time.c.

double sys_time_s ( const Timer t)

Returns the system time of a Timer in seconds.

Definition at line 134 of file time.c.

double sys_time_ms ( const Timer t)

Returns the system time of a Timer in milliseconds.

Definition at line 140 of file time.c.

double proc_user_time_s ( )

Returns the current ellapsed process user time in seconds.

Definition at line 156 of file time.c.

double proc_user_time_ms ( )

Returns the current ellapsed process user time in milliseconds.

Definition at line 166 of file time.c.

double proc_sys_time_s ( )

Returns the current ellapsed process system time in seconds.

Definition at line 185 of file time.c.

double proc_sys_time_ms ( )

Returns the system time of a Timer in milliseconds.

Definition at line 195 of file time.c.