YAZ  5.23.1
Data Structures | Functions
timing.c File Reference

Timing utilities. More...

#include <stdlib.h>
#include <time.h>
#include <yaz/xmalloc.h>
#include <yaz/timing.h>

Go to the source code of this file.

Data Structures

struct  yaz_timing
 

Functions

yaz_timing_t yaz_timing_create (void)
 create timing handle More...
 
void yaz_timing_start (yaz_timing_t t)
 start timer More...
 
void yaz_timing_stop (yaz_timing_t t)
 stop timer More...
 
double yaz_timing_get_real (yaz_timing_t t)
 returns real time in seconds More...
 
double yaz_timing_get_user (yaz_timing_t t)
 returns user time in seconds More...
 
double yaz_timing_get_sys (yaz_timing_t t)
 returns system time in seconds More...
 
void yaz_timing_destroy (yaz_timing_t *tp)
 destroys timing handle More...
 

Detailed Description

Timing utilities.

Definition in file timing.c.

Function Documentation

yaz_timing_t yaz_timing_create ( void  )

create timing handle

Returns
timing handle
 yaz_timing_t my = yaz_timing_create();
 yaz_timing_start(my);
 do_work();
 yaz_timing_stop(my);

 printf("real=%g user=%g sys=%g\n",
    yaz_timing_get_real(my),
    yaz_timing_get_user(my),
    yaz_timing_get_sys(my));

 yaz_timing_destroy(my);

Definition at line 47 of file timing.c.

References xmalloc, and yaz_timing_start().

Referenced by rdf_lookup_node().

void yaz_timing_destroy ( yaz_timing_t tp)

destroys timing handle

Definition at line 145 of file timing.c.

References xfree.

Referenced by rdf_lookup_node().

double yaz_timing_get_real ( yaz_timing_t  t)

returns real time in seconds

Parameters
ttiming handle
Returns
time in seconds

Definition at line 130 of file timing.c.

References yaz_timing::real_sec.

Referenced by rdf_lookup_debug_comment().

double yaz_timing_get_sys ( yaz_timing_t  t)

returns system time in seconds

Parameters
ttiming handle
Returns
time in seconds

Definition at line 140 of file timing.c.

References yaz_timing::sys_sec.

double yaz_timing_get_user ( yaz_timing_t  t)

returns user time in seconds

Parameters
ttiming handle
Returns
time in seconds

Definition at line 135 of file timing.c.

References yaz_timing::user_sec.

void yaz_timing_start ( yaz_timing_t  t)

start timer

Parameters
ttiming handle

Definition at line 81 of file timing.c.

References yaz_timing::real_sec, yaz_timing::sys_sec, and yaz_timing::user_sec.

Referenced by rdf_lookup_node(), and yaz_timing_create().

void yaz_timing_stop ( yaz_timing_t  t)

stop timer

Parameters
ttiming handle

Use yaz_timing_get_real, yaz_timing_get_user and yaz_timing_get_sys to fetch timing results.

Definition at line 106 of file timing.c.

References yaz_timing::real_sec, yaz_timing::sys_sec, and yaz_timing::user_sec.

Referenced by rdf_lookup_node().