CMS 3D CMS Logo

Public Member Functions | Private Attributes

hlt::CPUTimer Class Reference

#include <TimerService.h>

List of all members.

Public Member Functions

 CPUTimer (bool cpu=true)
double delta () const
void reset ()
void start ()
void stop ()

Private Attributes

timespec start_
timespec stop_
const clockid_t timer_

Detailed Description

Definition at line 36 of file TimerService.h.


Constructor & Destructor Documentation

hlt::CPUTimer::CPUTimer ( bool  cpu = true) [inline, explicit]

Definition at line 38 of file TimerService.h.

References reset().


Member Function Documentation

double hlt::CPUTimer::delta ( ) const [inline]

Definition at line 64 of file TimerService.h.

References start_, and stop_.

Referenced by TimerService::postModule().

                       {
    if (stop_.tv_nsec > start_.tv_nsec)
      return (double) (stop_.tv_sec - start_.tv_sec) + (double) (stop_.tv_nsec - start_.tv_nsec) / (double) 1e9;
    else
      return (double) (stop_.tv_sec - start_.tv_sec) - (double) (start_.tv_nsec - stop_.tv_nsec) / (double) 1e9;
  }
void hlt::CPUTimer::reset ( void  ) [inline]

Definition at line 44 of file TimerService.h.

References start_, and stop_.

Referenced by CPUTimer(), and TimerService::preModule().

                 {
      start_.tv_sec  = 0;
      start_.tv_nsec = 0;
      stop_.tv_sec   = 0;
      stop_.tv_nsec  = 0;
    }
void hlt::CPUTimer::start ( void  ) [inline]

Definition at line 51 of file TimerService.h.

References start_, and timer_.

Referenced by TimerService::preModule().

                 {
#ifdef __linux
      clock_gettime(timer_, & start_);
#endif
    }
void hlt::CPUTimer::stop ( ) [inline]

Definition at line 57 of file TimerService.h.

References stop_, and timer_.

Referenced by TimerService::postModule().

                {
#ifdef __linux
      clock_gettime(timer_, & stop_);
#endif
    }

Member Data Documentation

timespec hlt::CPUTimer::start_ [private]

Definition at line 73 of file TimerService.h.

Referenced by delta(), reset(), and start().

timespec hlt::CPUTimer::stop_ [private]

Definition at line 74 of file TimerService.h.

Referenced by delta(), reset(), and stop().

Definition at line 72 of file TimerService.h.

Referenced by start(), and stop().