GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
rtimer.h File Reference
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
Include dependency graph for rtimer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Rtimer
 

Macros

#define rt_start(rt)
 
#define rt_stop(rt)
 
#define rt_u_useconds(rt)
 
#define rt_s_useconds(rt)
 
#define rt_w_useconds(rt)
 
#define rt_zero(rt)   bzero(&(rt),sizeof(Rtimer));
 
#define rt_seconds(rt)   (rt_w_useconds(rt)/1000000)
 
#define rt_sprint(buf, rt)   rt_sprint_safe(buf,rt)
 

Functions

char * rt_sprint_safe (char *buf, Rtimer rt)
 

Macro Definition Documentation

◆ rt_s_useconds

#define rt_s_useconds (   rt)
Value:
(((double)rt.rut2.ru_stime.tv_usec + \
(double)rt.rut2.ru_stime.tv_sec*1000000) \
- ((double)rt.rut1.ru_stime.tv_usec + \
(double)rt.rut1.ru_stime.tv_sec*1000000))

Definition at line 107 of file rtimer.h.

Referenced by rt_sprint_safe().

◆ rt_seconds

#define rt_seconds (   rt)    (rt_w_useconds(rt)/1000000)

Definition at line 129 of file rtimer.h.

◆ rt_sprint

#define rt_sprint (   buf,
  rt 
)    rt_sprint_safe(buf,rt)

Definition at line 131 of file rtimer.h.

◆ rt_start

#define rt_start (   rt)
Value:
if((getrusage(RUSAGE_SELF, &rt.rut1) < 0) \
|| (gettimeofday(&(rt.tv1), NULL) < 0)) { \
perror("rusage/gettimeofday"); \
exit(1); \
}
#define NULL
Definition: ccmath.h:32

Definition at line 84 of file rtimer.h.

◆ rt_stop

#define rt_stop (   rt)
Value:
if((getrusage(RUSAGE_SELF, &rt.rut2) < 0) \
|| (gettimeofday(&(rt.tv2), NULL) < 0)) { \
perror("rusage/gettimeofday"); \
exit(1); \
}
#define NULL
Definition: ccmath.h:32

Definition at line 93 of file rtimer.h.

◆ rt_u_useconds

#define rt_u_useconds (   rt)
Value:
(((double)rt.rut2.ru_utime.tv_usec + \
(double)rt.rut2.ru_utime.tv_sec*1000000) \
- ((double)rt.rut1.ru_utime.tv_usec + \
(double)rt.rut1.ru_utime.tv_sec*1000000))

Definition at line 101 of file rtimer.h.

Referenced by rt_sprint_safe().

◆ rt_w_useconds

#define rt_w_useconds (   rt)
Value:
(((double)rt.tv2.tv_usec + \
(double)rt.tv2.tv_sec*1000000) \
- ((double)rt.tv1.tv_usec + \
(double)rt.tv1.tv_sec*1000000))

Definition at line 113 of file rtimer.h.

Referenced by rt_sprint_safe().

◆ rt_zero

#define rt_zero (   rt)    bzero(&(rt),sizeof(Rtimer));

Definition at line 127 of file rtimer.h.

Function Documentation

◆ rt_sprint_safe()

char* rt_sprint_safe ( char *  buf,
Rtimer  rt 
)

Definition at line 46 of file rtimer.cpp.

References rt_s_useconds, rt_u_useconds, and rt_w_useconds.