Pyrogenesis  trunk
Macros | Functions | Variables
timer.cpp File Reference
#include "precompiled.h"
#include "lib/timer.h"
#include <cfloat>
#include <cmath>
#include <cstdarg>
#include <mutex>
#include <numeric>
#include <sstream>
#include "lib/module_init.h"
#include "lib/posix/posix_time.h"
#include "lib/sysdep/cpu.h"
Include dependency graph for timer.cpp:

Macros

#define HAVE_GETTIMEOFDAY   0
 
#define HAVE_CLOCK_GETTIME   0
 

Functions

static Status InitResolution ()
 
void timer_Init ()
 timer_Time will subsequently return values relative to the current time. More...
 
static void EnsureMonotonic (double &newTime)
 
double timer_Time ()
 
double timer_Resolution ()
 
TimerClienttimer_AddClient (TimerClient *tc, const wchar_t *description)
 make the given TimerClient (usually instantiated as static data) ready for use. More...
 
void timer_DisplayClientTotals ()
 display all clients' totals; does not reset them. More...
 
std::string StringForSeconds (double seconds)
 internal helper functions for returning an easily readable string (i.e. More...
 
std::string StringForCycles (Cycles cycles)
 

Variables

static double resolution
 
static std::mutex ensure_monotonic_mutex
 
static size_t numClients
 
static TimerClientclients
 

Macro Definition Documentation

◆ HAVE_CLOCK_GETTIME

#define HAVE_CLOCK_GETTIME   0

◆ HAVE_GETTIMEOFDAY

#define HAVE_GETTIMEOFDAY   0

Function Documentation

◆ EnsureMonotonic()

static void EnsureMonotonic ( double &  newTime)
static

◆ InitResolution()

static Status InitResolution ( )
static

◆ StringForCycles()

std::string StringForCycles ( Cycles  cycles)

◆ StringForSeconds()

std::string StringForSeconds ( double  seconds)

internal helper functions for returning an easily readable string (i.e.

re-scaled to appropriate units)

◆ timer_AddClient()

TimerClient* timer_AddClient ( TimerClient tc,
const wchar_t *  description 
)

make the given TimerClient (usually instantiated as static data) ready for use.

returns its address for TIMER_ADD_CLIENT's convenience. this client's total (which is increased by a BillingPolicy) will be displayed by timer_DisplayClientTotals. notes:

  • may be called at any time;
  • always succeeds (there's no fixed limit);
  • free() is not needed nor possible.
  • description must remain valid until exit; a string literal is safest.

◆ timer_DisplayClientTotals()

void timer_DisplayClientTotals ( )

display all clients' totals; does not reset them.

typically called at exit.

◆ timer_Init()

void timer_Init ( )

timer_Time will subsequently return values relative to the current time.

◆ timer_Resolution()

double timer_Resolution ( )
Returns
resolution [s] of the timer.

◆ timer_Time()

double timer_Time ( )
Returns
high resolution (> 1 us) timestamp [s].

Variable Documentation

◆ clients

TimerClient* clients
static

◆ ensure_monotonic_mutex

std::mutex ensure_monotonic_mutex
static

◆ numClients

size_t numClients
static

◆ resolution

double resolution
static