reSIProcate/rutil  9694
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
resip::Timer Class Reference

This class is used to get the current system time. More...

#include <Timer.hxx>

List of all members.

Public Types

enum  Type {
  TimerA, TimerB, TimerC, TimerD,
  TimerE1, TimerE2, TimerF, TimerG,
  TimerH, TimerI, TimerJ, TimerK,
  TimerTrying, TimerStaleClient, TimerStaleServer, TimerStateless,
  TimerCleanUp, ApplicationTimer
}

Public Member Functions

 RESIP_HeapCount (Timer)

Static Public Member Functions

static Data toData (Type timer)
static void setupTimeOffsets ()
static UInt64 getTimeMicroSec ()
 Returns the current clock time in microseconds.
static UInt64 getTimeMs ()
 Returns the current clock time in milliseconds.
static UInt64 getTimeSecs ()
 Returns the current clock time in seconds.
static UInt64 getRandomFutureTimeMs (UInt64 futureMs)
 Returns an absolute time in ms that is between 50% and 90% of passed in ms from now.
static UInt64 getForever ()
 Infinit time in future.
static unsigned getMaxSystemTimeWaitMs (void)
 On windows, change getSystemTime() to not use the actual clock time returned by ::GetSystemTime().
static void resetT1 (unsigned long t1)

Static Public Attributes

static unsigned long T1 = 500
static unsigned long T2 = 8 * T1
static unsigned long T4 = 10 * T1
static unsigned long T100 = 80
static unsigned long TB = 64*T1
static unsigned long TC = 3*60*1000
static unsigned long TF = 64*T1
static unsigned long TH = 64*T1
static unsigned long TD = 32000
static unsigned long TS = 32000

Detailed Description

This class is used to get the current system time.

Note:
Should we refactor this? It seems like the SIP-timer stuff should live in resip/stack somewhere.

Definition at line 24 of file Timer.hxx.


Member Enumeration Documentation

Enumerator:
TimerA 
TimerB 
TimerC 
TimerD 
TimerE1 
TimerE2 
TimerF 
TimerG 
TimerH 
TimerI 
TimerJ 
TimerK 
TimerTrying 
TimerStaleClient 
TimerStaleServer 
TimerStateless 
TimerCleanUp 
ApplicationTimer 

Definition at line 28 of file Timer.hxx.

      {
         TimerA, // doubling
         TimerB,
         TimerC,
         TimerD,
         TimerE1,// doubling
         TimerE2,// doubling
         TimerF,
         TimerG, // doubling
         TimerH,
         TimerI,
         TimerJ,
         TimerK,
         TimerTrying,
         TimerStaleClient,
         TimerStaleServer,
         TimerStateless,
         TimerCleanUp,
         ApplicationTimer // .dlb. Fifo, so no thread issues
      } Type;

Member Function Documentation

static UInt64 resip::Timer::getForever ( ) [inline, static]

Infinit time in future.

Definition at line 84 of file Timer.hxx.

      {
         return ResipClock::getForever();
      }
static unsigned resip::Timer::getMaxSystemTimeWaitMs ( void  ) [inline, static]

On windows, change getSystemTime() to not use the actual clock time returned by ::GetSystemTime().

The replacement time function on some versions of windows (< Vista, GetTickCount()) returns a 32-bit value, so it will rollover at some point. Any code that waits on timers should not wait longer than this value.

See also:
resiprocate.org devlist discussion "Timers: why system time?";
resip::SipStack::getTimeTillNextProcessMS().

Definition at line 97 of file Timer.hxx.

static UInt64 resip::Timer::getRandomFutureTimeMs ( UInt64  futureMs) [inline, static]

Returns an absolute time in ms that is between 50% and 90% of passed in ms from now.

Definition at line 78 of file Timer.hxx.

      {
         return ResipClock::getRandomFutureTimeMs(futureMs);
      }
static UInt64 resip::Timer::getTimeMicroSec ( ) [inline, static]

Returns the current clock time in microseconds.

Definition at line 59 of file Timer.hxx.

Referenced by resip::AbstractFifo< Timestamped< Msg * > >::onFifoPolled(), and resip::AbstractFifo< Timestamped< Msg * > >::onMessagePushed().

static UInt64 resip::Timer::getTimeMs ( ) [inline, static]
static UInt64 resip::Timer::getTimeSecs ( ) [inline, static]

Returns the current clock time in seconds.

Definition at line 71 of file Timer.hxx.

Referenced by resip::RRList::encodeRecordItem(), resip::RRCache::lookup(), resip::RRList::RRList(), and resip::RRList::update().

      {
         return ResipClock::getTimeSecs();
      }
void Timer::resetT1 ( unsigned long  t1) [static]

Definition at line 57 of file Timer.cxx.

References T1, T2, T4, TB, TF, and TH.

{
   T1 = t1;
   T2 = 8 * T1;
   T4 = 10 * T1;
   TB = 64*T1;
   TF = 64*T1;
   TH = 64*T1;
}
resip::Timer::RESIP_HeapCount ( Timer  )
static void resip::Timer::setupTimeOffsets ( ) [inline, static]
Deprecated:
.

Does not do anything at the moment.

Definition at line 54 of file Timer.hxx.

Referenced by resip::Random::initialize().

      {}
Data Timer::toData ( Type  timer) [static]

Definition at line 68 of file Timer.cxx.

References TimerA, TimerB, TimerC, TimerCleanUp, TimerD, TimerE1, TimerE2, TimerF, TimerG, TimerH, TimerI, TimerJ, TimerK, TimerStaleClient, TimerStaleServer, TimerStateless, and TimerTrying.

{
   switch (timer)
   {
      case TimerA: // doubling
         return "Timer A";
      case TimerB:
         return "Timer B";
      case TimerC:
         return "Timer C";
      case TimerD:
         return "Timer D";
      case TimerE1:
         return "Timer E1";
      case TimerE2:
         return "Timer E2";
      case TimerF:
         return "Timer F";
      case TimerG: 
         return "Timer G";
      case TimerH:
         return "Timer H";
      case TimerI:
         return "Timer I";
      case TimerJ:
         return "Timer J";
      case TimerK:
         return "Timer K";
      case TimerTrying:
         return "Timer Trying";
      case TimerStaleClient:
         return "Timer StaleClient";
      case TimerStaleServer:
         return "Timer StaleServer";
      case TimerStateless:
         return "Timer Stateless";
      case TimerCleanUp:
         return "Timer Cleanup";
      default:
         assert(0);
   }
   return "Bad Bad Bad in timer";
}

Member Data Documentation

unsigned long resip::Timer::T1 = 500 [static]

Definition at line 107 of file Timer.hxx.

Referenced by resetT1().

unsigned long resip::Timer::T100 = 80 [static]

Definition at line 110 of file Timer.hxx.

unsigned long resip::Timer::T2 = 8 * T1 [static]

Definition at line 108 of file Timer.hxx.

Referenced by resetT1().

unsigned long resip::Timer::T4 = 10 * T1 [static]

Definition at line 109 of file Timer.hxx.

Referenced by resetT1().

unsigned long resip::Timer::TB = 64*T1 [static]

Definition at line 112 of file Timer.hxx.

Referenced by resetT1().

unsigned long resip::Timer::TC = 3*60*1000 [static]

Definition at line 113 of file Timer.hxx.

unsigned long resip::Timer::TD = 32000 [static]

Definition at line 117 of file Timer.hxx.

unsigned long resip::Timer::TF = 64*T1 [static]

Definition at line 114 of file Timer.hxx.

Referenced by resetT1().

unsigned long resip::Timer::TH = 64*T1 [static]

Definition at line 115 of file Timer.hxx.

Referenced by resetT1().

unsigned long resip::Timer::TS = 32000 [static]

Definition at line 118 of file Timer.hxx.


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