CpuCycleClock< cpuFreq > Struct Template Reference
Clock implementation for CPU cycle times. More...
#include <Clocks.h>
Inheritance diagram for CpuCycleClock< cpuFreq >:
Collaboration diagram for CpuCycleClock< cpuFreq >:
Public Types | |
using | TickType = uint32_t |
using | TicksConst = TicksConst< Clock, ticks > |
using | TimeConst = TimeConst< Clock, unit, time > |
using | TicksPerUnit = std::ratio_divide< std::ratio< frequency_ >, UnitTickRatio< unit > > |
using | TimeSource = TimeSource< Clock, unit, TimeType > |
using | Ticks = Ticks< Clock, T > |
using | MaxTicks = TicksConst< maxTicks_ > |
using | MaxTime = typename MaxTicks::template TimeConst< unit > |
Static Public Member Functions | |
static constexpr const char * | typeName () |
static uint32_t | ticks () |
static constexpr bool | isFast () |
static constexpr uint32_t | frequency () |
static constexpr MaxTicks | maxTicks () |
static constexpr MaxTime< unit > | maxTime () |
static Ratio32 | ticksPerUnit (Unit unit) |
Get ticks per unit as a Ratio object. More... | |
static constexpr TimeConst< unit, time > | timeConst () |
Class template defining a fixed time quantity. More... | |
static constexpr TicksConst< ticks > | ticksConst () |
Class template defining a fixed tick quantity. More... | |
static constexpr TimeSource< unit, TimeType > | timeSource () |
Create a Time Source for this Clock. More... | |
static Ticks< TimeType > | timeToTicks (TimeType time) |
Get the number of ticks for a given time. More... | |
static Time< TimeType > | ticksToTime (TimeType ticks) |
Get the time for a given number of clock ticks. More... | |
static String | toString () |
Detailed Description
template<CpuFrequency cpuFreq>
struct CpuCycleClock< cpuFreq >
Clock implementation for CPU cycle times.
- Note
- The intended purpose is to evaluate code performance and possibly for very short time interval requirements. The 32-bit counter overflows:
Overflows every 53.687 seconds @ 80MHz CPU clock Overflows every 26.843 seconds @ 160MHz CPU clock
Generally this will provide the shortest time periods.
Time calculations are fixed at compile time, so you should use either CpuCycleClockNormal or CpuCycleClockFast depending on the currently configured CPU speed.
- See also
- See
System::setCpuFrequency()
Member Typedef Documentation
◆ MaxTicks
|
inherited |
◆ MaxTime
|
inherited |
◆ Ticks
|
inherited |
◆ TicksConst
|
inherited |
◆ TicksPerUnit
|
inherited |
◆ TickType
|
inherited |
◆ TimeConst
|
inherited |
◆ TimeSource
|
inherited |
Member Function Documentation
◆ frequency()
|
inlinestaticinherited |
◆ isFast()
template<CpuFrequency cpuFreq>
|
inlinestatic |
◆ maxTicks()
|
inlinestaticinherited |
◆ maxTime()
|
inlinestaticinherited |
◆ ticks()
template<CpuFrequency cpuFreq>
|
inlinestatic |
◆ ticksConst()
|
inlinestaticinherited |
Class template defining a fixed tick quantity.
- Template Parameters
-
ticks
- Return values
-
TicksConst<Clock,ticks>
◆ ticksPerUnit()
|
inlinestaticinherited |
Get ticks per unit as a Ratio object.
- Return values
-
BasicRatio32
◆ ticksToTime()
|
inlinestaticinherited |
Get the time for a given number of clock ticks.
- Parameters
-
ticks
- Return values
-
TimeType Time count, rounded to the nearest unit
◆ timeConst()
|
inlinestaticinherited |
Class template defining a fixed time quantity.
- Template Parameters
-
time
- Return values
-
TimeConst
◆ timeSource()
|
inlinestaticinherited |
Create a Time Source for this Clock.
- Template Parameters
-
unit TimeType
◆ timeToTicks()
|
inlinestaticinherited |
Get the number of ticks for a given time.
- Parameters
-
time
- Return values
-
TimeType Tick count, rounded to the nearest tick
◆ toString()
|
inlinestaticinherited |
◆ typeName()
template<CpuFrequency cpuFreq>
|
inlinestatic |
The documentation for this struct was generated from the following file: