resonance 1.0.1
Loading...
Searching...
No Matches
cycles.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/timer.h"
4
6constexpr unsigned kCyclesPerMillisecond = 294912;
7
9constexpr int kMillisecondsPerSecond = 1000;
10
21unsigned ReadCycleCount();
22
41 const unsigned nCount = ReadCycleCount();
43 Timer::sElapsedTimer = nCount;
45 return static_cast<int>(Timer::sElapsedCycles / kCyclesPerMillisecond);
46}
47
static unsigned sLastCycleDelta
The difference the last call added to the total.
Definition timer.h:71
static unsigned sElapsedTimer
The counter reading the last call took.
Definition timer.h:60
static long long sElapsedCycles
Cycles accumulated across every read.
Definition timer.h:52
int GetMillisecondsPerSecond()
Report how many units GetElapsedMilliseconds() counts in one second.
Definition cycles.h:63
unsigned ReadCycleCount()
Read the free-running cycle counter.
constexpr unsigned kCyclesPerMillisecond
EE clock in cycles per millisecond, which is the divisor the elapsed time is computed with.
Definition cycles.h:6
constexpr int kMillisecondsPerSecond
Milliseconds in one second, the rate GetMillisecondsPerSecond() reports.
Definition cycles.h:9
int GetElapsedMilliseconds()
Report the milliseconds elapsed since the machine started.
Definition cycles.h:40