foobar2000 SDK  2015-08-03
Public Member Functions | Private Member Functions | Private Attributes
pfc::lores_timer

#include <timers.h>

Public Member Functions

 lores_timer ()
 
double query () const
 
double query_reset ()
 
pfc::string8 queryString (unsigned precision=3)
 
void start ()
 

Private Member Functions

double _query (tickcount_t p_time) const
 
void _start (tickcount_t p_time)
 

Private Attributes

t_uint64 m_last_seen
 
t_uint64 m_start
 

Detailed Description

Definition at line 90 of file timers.h.

Constructor & Destructor Documentation

pfc::lores_timer::lores_timer ( )
inline

Definition at line 92 of file timers.h.

92 : m_start() {}
t_uint64 m_start
Definition: timers.h:126

Member Function Documentation

double pfc::lores_timer::_query ( tickcount_t  p_time) const
inlineprivate

Definition at line 116 of file timers.h.

116  {
117 #ifdef PFC_TICKCOUNT_32BIT
118  t_uint64 time = p_time;
119  if (time < (m_last_seen & 0xFFFFFFFF)) time += 0x100000000;
120  m_last_seen = (m_last_seen & 0xFFFFFFFF00000000) + time;
121  return (double)(m_last_seen - m_start) / 1000.0;
122 #else
123  return (double)(p_time - m_start) / 1000.0;
124 #endif
125  }
uint64_t t_uint64
Definition: int_types.h:3
t_uint64 m_last_seen
Definition: timers.h:128
t_uint64 m_start
Definition: timers.h:126
void pfc::lores_timer::_start ( tickcount_t  p_time)
inlineprivate

Definition at line 110 of file timers.h.

110  {
111 #ifdef PFC_TICKCOUNT_32BIT
112  m_last_seen = p_time;
113 #endif
114  m_start = p_time;
115  }
t_uint64 m_last_seen
Definition: timers.h:128
t_uint64 m_start
Definition: timers.h:126
double pfc::lores_timer::query ( ) const
inline

Definition at line 97 of file timers.h.

97  {
98  return _query(getTickCount());
99  }
double _query(tickcount_t p_time) const
Definition: timers.h:116
tickcount_t getTickCount()
Definition: timers.h:48
double pfc::lores_timer::query_reset ( )
inline

Definition at line 100 of file timers.h.

100  {
101  tickcount_t time = getTickCount();
102  double ret = _query(time);
103  _start(time);
104  return ret;
105  }
double _query(tickcount_t p_time) const
Definition: timers.h:116
void _start(tickcount_t p_time)
Definition: timers.h:110
tickcount_t getTickCount()
Definition: timers.h:48
uint64_t tickcount_t
Definition: timers.h:47
pfc::string8 pfc::lores_timer::queryString ( unsigned  precision = 3)
inline

Definition at line 106 of file timers.h.

106  {
107  return pfc::format_time_ex( query(), precision ).get_ptr();
108  }
const char * get_ptr() const
Definition: string_base.h:492
double query() const
Definition: timers.h:97
void pfc::lores_timer::start ( )
inline

Definition at line 93 of file timers.h.

93  {
95  }
void _start(tickcount_t p_time)
Definition: timers.h:110
tickcount_t getTickCount()
Definition: timers.h:48

Field Documentation

t_uint64 pfc::lores_timer::m_last_seen
mutableprivate

Definition at line 128 of file timers.h.

t_uint64 pfc::lores_timer::m_start
private

Definition at line 126 of file timers.h.


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