ATLAS Offline Software
Loading...
Searching...
No Matches
RegSelTimer.cxx File Reference
#include <stdlib.h>
#include <pthread.h>
#include "RegSelLUT/RegSelTimer.h"
Include dependency graph for RegSelTimer.cxx:

Go to the source code of this file.

Classes

struct  __gtttimer

Macros

#define _timersub   Timersub

Functions

int Timersub (struct timeval *, struct timeval *, struct timeval *)
void __free_timer (void *t)
 destructor
void __gtt_gettime (struct timeval *t)
 initialiser
struct timeval gtttimer_start (void)
 significantly (0.02ms) faster and simpler timer start/stop functions
double gttd (struct timeval time)
double gtttimer_stop (struct timeval start_time)

Macro Definition Documentation

◆ _timersub

#define _timersub   Timersub

Definition at line 40 of file RegSelTimer.cxx.

Function Documentation

◆ __free_timer()

void __free_timer ( void * t)

destructor

Definition at line 48 of file RegSelTimer.cxx.

48{ if ( t!=nullptr ) free((__gtttimer*)t); }

◆ __gtt_gettime()

void __gtt_gettime ( struct timeval * t)

initialiser

initialise the gtttimer thread specific key get the time, (probably needlessly) mutex protected call to gettimeofday

Definition at line 70 of file RegSelTimer.cxx.

71{
72 // pthread_mutex_lock(&time_lock);
73 gettimeofday (t, nullptr);
74 // pthread_mutex_unlock(&time_lock);
75}

◆ gttd()

double gttd ( struct timeval time)

Definition at line 126 of file RegSelTimer.cxx.

126{ return (time.tv_sec*1000.0) + (time.tv_usec/1000.0); }
time(flags, cells_name, *args, **kw)

◆ gtttimer_start()

struct timeval gtttimer_start ( void )

significantly (0.02ms) faster and simpler timer start/stop functions

Definition at line 118 of file RegSelTimer.cxx.

119{
120 struct timeval start_time;
121 __gtt_gettime (&start_time);
122 return start_time;
123}
void __gtt_gettime(struct timeval *t)
initialiser

◆ gtttimer_stop()

double gtttimer_stop ( struct timeval start_time)

Definition at line 128 of file RegSelTimer.cxx.

129{
130 double time = 0;
131 struct timeval stop_time;
132 struct timeval diff_time;
133 // double diff;
134
135 __gtt_gettime (&stop_time);
136 // pthread_mutex_lock(&time_lock);
137 _timersub( &stop_time, &start_time, &diff_time );
138 // printf("diff: %d\n", _timersub( &stop_time, &start_time, &diff_time ) );
139 // diff = gttd(stop_time)-gttd(start_time);
140 // printf("timer: %12.5f %12.5f %12.5f %12.5f\n", gttd(stop_time), gttd(start_time), gttd(diff_time), diff );
141 // pthread_mutex_unlock(&time_lock);
142 time = (diff_time.tv_sec*1000.0) + (diff_time.tv_usec/1000.0);
143 return time;
144}
#define _timersub

◆ Timersub()

int Timersub ( struct timeval * stop_time,
struct timeval * start_time,
struct timeval * diff_time )

Definition at line 147 of file RegSelTimer.cxx.

148{
149 diff_time->tv_sec = stop_time->tv_sec - start_time->tv_sec;
150 diff_time->tv_usec = stop_time->tv_usec - start_time->tv_usec;
151 return 0;
152}