OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ossimTimer Class Reference

Timer class is used for measuring elapsed time or time between two points. More...

#include <ossimTimer.h>

Public Types

typedef unsigned long long Timer_t
 

Public Member Functions

 ossimTimer ()
 
 ~ossimTimer ()
 
Timer_t tick () const
 Get the timers tick value. More...
 
void setStartTick ()
 Set the start. More...
 
void setStartTick (Timer_t t)
 
Timer_t getStartTick () const
 
double time_s () const
 Get elapsed time in seconds. More...
 
double time_m () const
 Get elapsed time in milliseconds. More...
 
double time_u () const
 Get elapsed time in micoseconds. More...
 
double time_n () const
 Get elapsed time in nanoseconds. More...
 
double delta_s (Timer_t t1, Timer_t t2) const
 Get the time in seconds between timer ticks t1 and t2. More...
 
double delta_s (Timer_t t1) const
 
double delta_m (Timer_t t1, Timer_t t2) const
 Get the time in milliseconds between timer ticks t1 and t2. More...
 
double delta_m (Timer_t t1) const
 
double delta_u (Timer_t t1, Timer_t t2) const
 Get the time in microseconds between timer ticks t1 and t2. More...
 
double delta_u (Timer_t t1) const
 
double delta_n (Timer_t t1, Timer_t t2) const
 Get the time in nanoseconds between timer ticks t1 and t2. More...
 
double delta_n (Timer_t t1) const
 
double getSecondsPerTick () const
 Get the the number of seconds per tick. More...
 

Static Public Member Functions

static ossimTimerinstance ()
 

Protected Attributes

Timer_t m_startTick
 
double m_secsPerTick
 

Static Protected Attributes

static ossimTimerm_instance = 0
 

Detailed Description

Timer class is used for measuring elapsed time or time between two points.

Definition at line 10 of file ossimTimer.h.

Member Typedef Documentation

◆ Timer_t

typedef unsigned long long ossimTimer::Timer_t

Definition at line 16 of file ossimTimer.h.

Constructor & Destructor Documentation

◆ ossimTimer()

ossimTimer::ossimTimer ( )

Definition at line 75 of file ossimTimer.cpp.

References m_secsPerTick, and setStartTick().

Referenced by instance().

76 {
77  m_secsPerTick = (1.0 / (double) 1000000);
78 
79  setStartTick();
80 }
void setStartTick()
Set the start.
Definition: ossimTimer.h:27
double m_secsPerTick
Definition: ossimTimer.h:66

◆ ~ossimTimer()

ossimTimer::~ossimTimer ( )
inline

Definition at line 19 of file ossimTimer.h.

19 {m_instance = 0;}
static ossimTimer * m_instance
Definition: ossimTimer.h:64

Member Function Documentation

◆ delta_m() [1/2]

double ossimTimer::delta_m ( Timer_t  t1,
Timer_t  t2 
) const
inline

Get the time in milliseconds between timer ticks t1 and t2.

Definition at line 49 of file ossimTimer.h.

49 { return delta_s(t1,t2)*1e3; }
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ delta_m() [2/2]

double ossimTimer::delta_m ( Timer_t  t1) const
inline

Definition at line 50 of file ossimTimer.h.

50 { return delta_s(t1,tick())*1e3; }
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ delta_n() [1/2]

double ossimTimer::delta_n ( Timer_t  t1,
Timer_t  t2 
) const
inline

Get the time in nanoseconds between timer ticks t1 and t2.

Definition at line 57 of file ossimTimer.h.

57 { return delta_s(t1,t2)*1e9; }
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ delta_n() [2/2]

double ossimTimer::delta_n ( Timer_t  t1) const
inline

Definition at line 58 of file ossimTimer.h.

58 { return delta_s(t1,tick())*1e9; }
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ delta_s() [1/2]

double ossimTimer::delta_s ( Timer_t  t1,
Timer_t  t2 
) const
inline

Get the time in seconds between timer ticks t1 and t2.

Definition at line 45 of file ossimTimer.h.

45 { return (double)(t2 - t1)*m_secsPerTick; }
double m_secsPerTick
Definition: ossimTimer.h:66

◆ delta_s() [2/2]

double ossimTimer::delta_s ( Timer_t  t1) const
inline

Definition at line 46 of file ossimTimer.h.

46 { return (double)(tick() - t1)*m_secsPerTick; }
double m_secsPerTick
Definition: ossimTimer.h:66
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95

◆ delta_u() [1/2]

double ossimTimer::delta_u ( Timer_t  t1,
Timer_t  t2 
) const
inline

Get the time in microseconds between timer ticks t1 and t2.

Definition at line 53 of file ossimTimer.h.

53 { return delta_s(t1,t2)*1e6; }
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ delta_u() [2/2]

double ossimTimer::delta_u ( Timer_t  t1) const
inline

Definition at line 54 of file ossimTimer.h.

54 { return delta_s(t1,tick())*1e6; }
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ getSecondsPerTick()

double ossimTimer::getSecondsPerTick ( ) const
inline

Get the the number of seconds per tick.

Definition at line 61 of file ossimTimer.h.

61 { return m_secsPerTick; }
double m_secsPerTick
Definition: ossimTimer.h:66

◆ getStartTick()

Timer_t ossimTimer::getStartTick ( ) const
inline

Definition at line 29 of file ossimTimer.h.

29 { return m_startTick; }
Timer_t m_startTick
Definition: ossimTimer.h:65

◆ instance()

ossimTimer * ossimTimer::instance ( )
static

◆ setStartTick() [1/2]

void ossimTimer::setStartTick ( )
inline

Set the start.

Definition at line 27 of file ossimTimer.h.

Referenced by ossimBatchTest::execute(), and ossimTimer().

27 { m_startTick = tick(); }
Timer_t m_startTick
Definition: ossimTimer.h:65
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95

◆ setStartTick() [2/2]

void ossimTimer::setStartTick ( Timer_t  t)
inline

Definition at line 28 of file ossimTimer.h.

28 { m_startTick = t; }
Timer_t m_startTick
Definition: ossimTimer.h:65

◆ tick()

ossimTimer::Timer_t ossimTimer::tick ( ) const

Get the timers tick value.

Definition at line 95 of file ossimTimer.cpp.

Referenced by ossim::CurlHeaderCache::addHeader(), ossimElevationCellDatabase::CellInfo::CellInfo(), ossim::CurlHeaderCache::touchEntryProtected(), and ossimElevationCellDatabase::CellInfo::updateTimestamp().

96  {
97  struct timeval tv;
98  gettimeofday(&tv, NULL);
99  return ((ossimTimer::Timer_t)tv.tv_sec)*1000000+(ossimTimer::Timer_t)tv.tv_usec;
100  }
unsigned long long Timer_t
Definition: ossimTimer.h:16

◆ time_m()

double ossimTimer::time_m ( ) const
inline

Get elapsed time in milliseconds.

Definition at line 36 of file ossimTimer.h.

36 { return delta_m(m_startTick, tick()); }
Timer_t m_startTick
Definition: ossimTimer.h:65
double delta_m(Timer_t t1, Timer_t t2) const
Get the time in milliseconds between timer ticks t1 and t2.
Definition: ossimTimer.h:49
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95

◆ time_n()

double ossimTimer::time_n ( ) const
inline

Get elapsed time in nanoseconds.

Definition at line 42 of file ossimTimer.h.

42 { return delta_n(m_startTick, tick()); }
Timer_t m_startTick
Definition: ossimTimer.h:65
double delta_n(Timer_t t1, Timer_t t2) const
Get the time in nanoseconds between timer ticks t1 and t2.
Definition: ossimTimer.h:57
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95

◆ time_s()

double ossimTimer::time_s ( ) const
inline

Get elapsed time in seconds.

Definition at line 33 of file ossimTimer.h.

Referenced by ossimBatchTest::execute(), ossimMultiThreadSequencer::getNextTile(), ossimMultiThreadSequencer::nextJob(), ossimBatchTest::processCommands(), ossimMultiThreadSequencer::ossimGetTileJob::run(), and ossimMultiThreadSequencer::setTileInCache().

33 { return delta_s(m_startTick, tick()); }
Timer_t m_startTick
Definition: ossimTimer.h:65
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition: ossimTimer.h:45

◆ time_u()

double ossimTimer::time_u ( ) const
inline

Get elapsed time in micoseconds.

Definition at line 39 of file ossimTimer.h.

39 { return delta_u(m_startTick, tick()); }
Timer_t m_startTick
Definition: ossimTimer.h:65
double delta_u(Timer_t t1, Timer_t t2) const
Get the time in microseconds between timer ticks t1 and t2.
Definition: ossimTimer.h:53
Timer_t tick() const
Get the timers tick value.
Definition: ossimTimer.cpp:95

Member Data Documentation

◆ m_instance

ossimTimer * ossimTimer::m_instance = 0
staticprotected

Definition at line 64 of file ossimTimer.h.

Referenced by instance().

◆ m_secsPerTick

double ossimTimer::m_secsPerTick
protected

Definition at line 66 of file ossimTimer.h.

Referenced by ossimTimer().

◆ m_startTick

Timer_t ossimTimer::m_startTick
protected

Definition at line 65 of file ossimTimer.h.


The documentation for this class was generated from the following files: