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

#include <timers.h>

Public Member Functions

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

Private Member Functions

double _query (t_uint64 p_val) const
 

Static Private Member Functions

static t_uint64 g_query ()
 
static t_uint64 g_query_freq ()
 

Private Attributes

t_uint64 m_start
 
double m_start
 

Detailed Description

Definition at line 55 of file timers.h.

Constructor & Destructor Documentation

pfc::hires_timer::hires_timer ( )
inline

Definition at line 57 of file timers.h.

57 : m_start() {}
t_uint64 m_start
Definition: timers.h:87
pfc::hires_timer::hires_timer ( )
inline

Definition at line 138 of file timers.h.

138 : m_start() {}
t_uint64 m_start
Definition: timers.h:87

Member Function Documentation

double pfc::hires_timer::_query ( t_uint64  p_val) const
inlineprivate

Definition at line 74 of file timers.h.

74  {
75  return (double)( p_val - m_start ) / (double) g_query_freq();
76  }
t_uint64 m_start
Definition: timers.h:87
static t_uint64 g_query_freq()
Definition: timers.h:82
static t_uint64 pfc::hires_timer::g_query ( )
inlinestaticprivate

Definition at line 77 of file timers.h.

77  {
78  LARGE_INTEGER val;
79  if (!QueryPerformanceCounter(&val)) throw pfc::exception_not_implemented();
80  return val.QuadPart;
81  }
static t_uint64 pfc::hires_timer::g_query_freq ( )
inlinestaticprivate

Definition at line 82 of file timers.h.

82  {
83  LARGE_INTEGER val;
84  if (!QueryPerformanceFrequency(&val)) throw pfc::exception_not_implemented();
85  return val.QuadPart;
86  }
double pfc::hires_timer::query ( ) const
inline

Definition at line 61 of file timers.h.

61  {
62  return _query( g_query() );
63  }
double _query(t_uint64 p_val) const
Definition: timers.h:74
static t_uint64 g_query()
Definition: timers.h:77
double pfc::hires_timer::query ( ) const
double pfc::hires_timer::query_reset ( )
inline

Definition at line 64 of file timers.h.

64  {
65  t_uint64 current = g_query();
66  double ret = _query(current);
67  m_start = current;
68  return ret;
69  }
uint64_t t_uint64
Definition: int_types.h:3
double _query(t_uint64 p_val) const
Definition: timers.h:74
t_uint64 m_start
Definition: timers.h:87
static t_uint64 g_query()
Definition: timers.h:77
double pfc::hires_timer::query_reset ( )
pfc::string8 pfc::hires_timer::queryString ( unsigned  precision = 6)
inline

Definition at line 70 of file timers.h.

70  {
71  return pfc::format_time_ex( query(), precision ).get_ptr();
72  }
const char * get_ptr() const
Definition: string_base.h:492
double query() const
Definition: timers.h:61
pfc::string8 pfc::hires_timer::queryString ( unsigned  precision = 3)
void pfc::hires_timer::start ( )
inline

Definition at line 58 of file timers.h.

58  {
59  m_start = g_query();
60  }
t_uint64 m_start
Definition: timers.h:87
static t_uint64 g_query()
Definition: timers.h:77
void pfc::hires_timer::start ( )

Field Documentation

t_uint64 pfc::hires_timer::m_start
private

Definition at line 87 of file timers.h.

double pfc::hires_timer::m_start
private

Definition at line 144 of file timers.h.


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