tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
detail::CycleCounterX86 Struct Reference

Hardware cycle counter for x86/x86_64. More...

#include <cycle_counter_x86.h>

Public Member Functions

FORCE_INLINE void start () noexcept
 Record the starting cycle count (serialized).
 
FORCE_INLINE void stop () noexcept
 Record the ending cycle count and accumulate.
 
void reset () noexcept
 Reset accumulated cycles and run count to zero.
 
double avg_cycles () const
 Return the average cycles per start/stop pair.
 

Public Attributes

unsigned long long start_cycles
 
unsigned long long total_cycles = 0
 
unsigned long long runs = 0
 

Detailed Description

Hardware cycle counter for x86/x86_64.

Uses __rdtsc() for timestamp reads, with _mm_lfence() to serialize instruction execution and prevent out-of-order measurement artifacts.

Member Function Documentation

◆ avg_cycles()

double detail::CycleCounterX86::avg_cycles ( ) const
inline

Return the average cycles per start/stop pair.

◆ reset()

void detail::CycleCounterX86::reset ( )
inlinenoexcept

Reset accumulated cycles and run count to zero.

◆ start()

FORCE_INLINE void detail::CycleCounterX86::start ( )
inlinenoexcept

Record the starting cycle count (serialized).

◆ stop()

FORCE_INLINE void detail::CycleCounterX86::stop ( )
inlinenoexcept

Record the ending cycle count and accumulate.

Member Data Documentation

◆ runs

unsigned long long detail::CycleCounterX86::runs = 0

◆ start_cycles

unsigned long long detail::CycleCounterX86::start_cycles

◆ total_cycles

unsigned long long detail::CycleCounterX86::total_cycles = 0

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