Pyrogenesis  trunk
Classes | Namespaces | Functions | Variables
whrt.cpp File Reference
#include "precompiled.h"
#include "lib/sysdep/os/win/whrt/whrt.h"
#include <process.h>
#include "lib/sysdep/cpu.h"
#include "lib/sysdep/os/win/wutil.h"
#include "lib/sysdep/os/win/winit.h"
#include "lib/sysdep/acpi.h"
#include "lib/bits.h"
#include "lib/sysdep/os/win/whrt/counter.h"
Include dependency graph for whrt.cpp:

Classes

struct  TimerState
 stores all timer state shared between readers and the update thread. More...
 

Namespaces

 ERR
 

Introduction


 

Functions

 WINIT_REGISTER_EARLY_INIT2 (whrt_Init)
 
 WINIT_REGISTER_LATE_SHUTDOWN (whrt_Shutdown)
 
static Status ActivateCounter (ICounter *counter)
 
static ICounterGetNextBestSafeCounter ()
 
static void InitCounter ()
 
static void ShutdownCounter ()
 
static u64 Counter ()
 
static u64 CounterDelta (u64 oldCounter, u64 newCounter)
 
double whrt_Resolution ()
 
static __declspec (align(64)) TimerState timerStates[2]
 
static void UpdateTimerState ()
 
double whrt_Time ()
 
static unsigned __stdcall UpdateThread (void *data)
 
static Status InitUpdateThread ()
 
static void ShutdownUpdateThread ()
 
static Status whrt_Init ()
 
static Status whrt_Shutdown ()
 

Variables

const Status ERR::WHRT_COUNTER_UNSAFE = 140000
 
static ICountercounter
 
static double nominalFrequency
 
static double resolution
 
static size_t counterBits
 
static u64 counterMask
 
static volatile TimerState *volatile ts = &timerStates[0]
 
static volatile TimerState *volatile ts2 = &timerStates[1]
 
static const DWORD UPDATE_INTERVAL_MS = 1000
 
static HANDLE hExitEvent
 
static HANDLE hUpdateThread
 

Function Documentation

static __declspec ( align(64)  )
static
static Status ActivateCounter ( ICounter counter)
inlinestatic
static u64 Counter ( )
inlinestatic
static u64 CounterDelta ( u64  oldCounter,
u64  newCounter 
)
inlinestatic
Returns
difference [ticks], taking rollover into account. (time-critical, so it's not called through ICounter.)
static ICounter* GetNextBestSafeCounter ( )
static
Returns
the newly created and unique instance of the next best counter that is deemed safe, or 0 if all have already been created.
static void InitCounter ( )
static
static Status InitUpdateThread ( )
inlinestatic
static void ShutdownCounter ( )
static
static void ShutdownUpdateThread ( )
inlinestatic
static unsigned __stdcall UpdateThread ( void *  data)
static
static void UpdateTimerState ( )
static
static Status whrt_Init ( )
static
double whrt_Resolution ( )
static Status whrt_Shutdown ( )
static
double whrt_Time ( )
WINIT_REGISTER_EARLY_INIT2 ( whrt_Init  )
WINIT_REGISTER_LATE_SHUTDOWN ( whrt_Shutdown  )

Variable Documentation

ICounter* counter
static
size_t counterBits
static
u64 counterMask
static
HANDLE hExitEvent
static
HANDLE hUpdateThread
static
double nominalFrequency
static
double resolution
static
volatile TimerState* volatile ts = &timerStates[0]
static
volatile TimerState* volatile ts2 = &timerStates[1]
static
const DWORD UPDATE_INTERVAL_MS = 1000
static