Pixar Arch
Loading...
Searching...
No Matches
timing.h File Reference

High-resolution, low-cost timing routines. More...

#include "./api.h"
#include "./defines.h"
#include "./inttypes.h"
#include <algorithm>
#include <atomic>
#include <iterator>
#include <numeric>

Go to the source code of this file.

Classes

struct  pxr::ArchIntervalTimer
 A simple timer class for measuring an interval of time using the ArchTickTimer facilities. More...
 

Namespaces

namespace  pxr
 

Functions

uint64_t pxr::ArchGetTickTime ()
 Return the current time in system-dependent units.
 
uint64_t pxr::ArchGetStartTickTime ()
 Get a "start" tick time for measuring an interval of time, followed by a later call to ArchGetStopTickTime().
 
uint64_t pxr::ArchGetStopTickTime ()
 Get a "stop" tick time for measuring an interval of time.
 
ARCH_API uint64_t pxr::ArchGetTickQuantum ()
 Return the tick time resolution.
 
ARCH_API uint64_t pxr::ArchGetIntervalTimerTickOverhead ()
 Return the ticks taken to record an interval of time with ArchIntervalTimer, as measured at startup time.
 
ARCH_API int64_t pxr::ArchTicksToNanoseconds (uint64_t nTicks)
 Convert a duration measured in "ticks", as returned by ArchGetTickTime(), to nanoseconds.
 
ARCH_API double pxr::ArchTicksToSeconds (uint64_t nTicks)
 Convert a duration measured in "ticks", as returned by ArchGetTickTime(), to seconds.
 
ARCH_API uint64_t pxr::ArchSecondsToTicks (double seconds)
 Convert a duration in seconds to "ticks", as returned by ArchGetTickTime().
 
ARCH_API double pxr::ArchGetNanosecondsPerTick ()
 Get nanoseconds per tick.
 
ARCH_API uint64_t pxr::Arch_MeasureExecutionTime (uint64_t maxTicks, bool *reachedConsensus, void const *m, uint64_t(*callM)(void const *, int))
 
template<class Fn >
uint64_t pxr::ArchMeasureExecutionTime (Fn const &fn, uint64_t maxTicks=1e7, bool *reachedConsensus=nullptr)
 Run fn repeatedly attempting to determine a consensus fastest execution time with low noise, for up to maxTicks, then return the consensus fastest execution time.
 

Detailed Description

High-resolution, low-cost timing routines.