CpuCycleClock< cpuFreq > Struct Template Reference

Clock implementation for CPU cycle times. More...

#include <Clocks.h>

Inheritance diagram for CpuCycleClock< cpuFreq >:
[legend]
Collaboration diagram for CpuCycleClock< cpuFreq >:
[legend]

Static Public Member Functions

static constexpr const char * typeName ()
 
static uint32_t ticks ()
 
static constexpr bool isFast ()
 
- Static Public Member Functions inherited from NanoTime::Clock< CpuCycleClock< cpuFreq >, uint32_t(cpuFreq) *1000000, uint32_t, 0xFFFFFFFF >
static constexpr const char * typeName ()
 
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 ()
 

Additional Inherited Members

- Public Types inherited from NanoTime::Clock< CpuCycleClock< cpuFreq >, uint32_t(cpuFreq) *1000000, uint32_t, 0xFFFFFFFF >
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 >
 

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 Function Documentation

◆ isFast()

template<CpuFrequency cpuFreq>
static constexpr bool CpuCycleClock< cpuFreq >::isFast ( )
inlinestatic

◆ ticks()

template<CpuFrequency cpuFreq>
static uint32_t CpuCycleClock< cpuFreq >::ticks ( )
inlinestatic

◆ typeName()

template<CpuFrequency cpuFreq>
static constexpr const char* CpuCycleClock< cpuFreq >::typeName ( )
inlinestatic

The documentation for this struct was generated from the following file: