Skip to content

Class timestamps

class timestamps<max_count, fence> runtime

template <size_t max_count = 64, bool fence = true>
struct timestamps { … }

High-resolution scoped profiler using RDTSC (x86) or CNTVCT_EL0 (AArch64).

Template parameters
max_count Maximum number of timestamp entries (default 64).
fence If true, insert serialization fences around the hardware counter read to reduce out-of-order measurement error.

function compute_rdtsc_overhead()

static uint64_t compute_rdtsc_overhead()

Measure and return the RDTSC read overhead in cycles.

Takes 50 back-to-back RDTSC readings, sorts them, and returns the 25th-percentile value. This value is subtracted from every recorded duration so that short measurements are not dominated by the cost of reading the counter itself.

Fully qualified name: kfr::timestamps<max_count, fence>::compute_rdtsc_overhead()

Declared at runtime/time.hpp:182

variable rdtsc_overhead

static inline uint64_t rdtsc_overhead = compute_rdtsc_overhead()

Fully qualified name: kfr::timestamps<max_count, fence>::rdtsc_overhead

Declared at runtime/time.hpp:202

variable last

uint64_t last = 0

Cycle count captured by init or the most recent record ; used as the reference point for the next duration measurement.

Fully qualified name: kfr::timestamps<max_count, fence>::last

Declared at runtime/time.hpp:206

variable dur

uint64_t dur[max_count]{}

Per-checkpoint elapsed cycle counts (overhead-subtracted), indexed by record order.

Fully qualified name: kfr::timestamps<max_count, fence>::dur

Declared at runtime/time.hpp:208

variable msg

const char* msg[max_count]{}

Per-checkpoint labels, parallel to dur .

Fully qualified name: kfr::timestamps<max_count, fence>::msg

Declared at runtime/time.hpp:210

variable count

size_t count = 0

Number of checkpoints currently stored in dur / msg .

Fully qualified name: kfr::timestamps<max_count, fence>::count

Declared at runtime/time.hpp:212

function init()

Reset the profiler, capturing the current cycle count as time zero.

Fully qualified name: kfr::timestamps<max_count, fence>::init()

Declared at runtime/time.hpp:215

function min(const timestamps<max_count, fence> &)

timestamps min(const timestamps& other) const noexcept

Return a new timestamps object containing the per-slot minimum durations.

Fully qualified name: kfr::timestamps<max_count, fence>::min(const timestamps<max_count, fence> &)

Declared at runtime/time.hpp:227

function record(const char *)

Record a timestamp checkpoint with an optional label.

Parameters
msg Short description stored alongside this checkpoint.
Returns
true if the entry was recorded; false if max_count was exceeded.

Fully qualified name: kfr::timestamps<max_count, fence>::record(const char *)

Declared at runtime/time.hpp:257

Fully qualified name: kfr::timestamps<max_count, fence>

Declared at runtime/time.hpp:173

This file was generated by cxxdox, a C++ documentation generator based on MkDocs Material and libclang.