libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::NTUtils::CPUTicker Class Reference

#include <CPUTicker.hpp>

Classes

class  CPUCountFn
 

Public Types

typedef win_exception exception_type
 

Public Member Functions

__stdcall CPUTicker (void)
 
__stdcall CPUTicker (const CPUTicker &) noexcept(true)
 
__stdcall ~CPUTicker (void)
 
CPUTicker &__fastcall operator= (const CPUTicker &) noexcept(true)
 
void __fastcall GetCPUCount (void) noexcept(true)
 
double __fastcall GetTickCountAsSeconds (void) const
 
unsigned __int64 __fastcall GetTickCountUS (void) const noexcept(true)
 
signed __int64 __fastcall GetTickCountS (void) const
 
const bool __fastcall GetAndCalcCPUFrequency (double &frequency, double &target_ave_dev, const unsigned long interval=1000, const unsigned int max_loops=20)
 
void __fastcall GetCPUFrequency (double &frequency, double &target_ave_dev) const noexcept(true)
 
CPUTicker __fastcall operator- (const CPUTicker &) const
 

Detailed Description

Definition at line 60 of file CPUTicker.hpp.

Member Typedef Documentation

◆ exception_type

Definition at line 62 of file CPUTicker.hpp.

Constructor & Destructor Documentation

◆ CPUTicker() [1/2]

CPUTicker::CPUTicker ( void  )
inline

Definition at line 169 of file CPUTicker.cpp.

◆ CPUTicker() [2/2]

__stdcall jmmcg::NTUtils::CPUTicker::CPUTicker ( const CPUTicker )
noexcept

◆ ~CPUTicker()

CPUTicker::~CPUTicker ( void  )
inline

Definition at line 186 of file CPUTicker.cpp.

Member Function Documentation

◆ GetAndCalcCPUFrequency()

const bool CPUTicker::GetAndCalcCPUFrequency ( double &  frequency,
double &  target_ave_dev,
const unsigned long  interval = 1000,
const unsigned int  max_loops = 20 
)

The following function will work out the processor clock frequency to a specified accuracy determined by the target average deviation required. Note that the worst average deviation of the result is less than 5MHz for a mean frequency of 90MHz. So basically the target average deviation is supplied only if you want a more accurate result, it won't let you get a worse one. (Units are Hz.)

(The average deviation is a better and more robust measure than it's cousin the standard deviation of a quantity. The item determined by each is essentially similar. See "Numerical Recipies", W.Press et al for more details.)

This function will run for a maximum of 20 seconds before giving up on trying to improve the average deviation, with the average deviation actually achieved replacing the supplied target value. Use "max_loops" to change this. To improve the value the function converges to increase "interval" (which is in units of ms, default value=1000ms).

Definition at line 223 of file CPUTicker.cpp.

◆ GetCPUCount()

void CPUTicker::GetCPUCount ( void  )
inlinenoexcept

Definition at line 198 of file CPUTicker.cpp.

◆ GetCPUFrequency()

void __fastcall jmmcg::NTUtils::CPUTicker::GetCPUFrequency ( double &  frequency,
double &  target_ave_dev 
) const
inlinenoexcept

Definition at line 128 of file CPUTicker.hpp.

◆ GetTickCountAsSeconds()

double __fastcall jmmcg::NTUtils::CPUTicker::GetTickCountAsSeconds ( void  ) const
inline

Definition at line 100 of file CPUTicker.hpp.

◆ GetTickCountS()

signed __int64 CPUTicker::GetTickCountS ( void  ) const

Definition at line 203 of file CPUTicker.cpp.

◆ GetTickCountUS()

unsigned __int64 __fastcall jmmcg::NTUtils::CPUTicker::GetTickCountUS ( void  ) const
inlinenoexcept

Definition at line 103 of file CPUTicker.hpp.

◆ operator-()

CPUTicker CPUTicker::operator- ( const CPUTicker ticker) const

Definition at line 212 of file CPUTicker.cpp.

◆ operator=()

CPUTicker & CPUTicker::operator= ( const CPUTicker ticker)
noexcept

Definition at line 190 of file CPUTicker.cpp.


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