Motivation
The buffer size is hardcoded as BUFFER_PWR = 16 (65 536 samples per ID per thread). This is a poor fit for two common situations:
- Embedded / constrained systems: 65 536 × 8 bytes = 512 KB per ID per thread is too much. A game running 10 IDs on 8 threads uses 40 MB just for Latte.
- Long-running stress tests: users want to capture millions of samples without wrap-around, requiring a larger buffer.
Proposed Change
// User defines before including the header (optional):
// #define LATTE_BUFFER_PWR 20 // 1M samples
#ifndef LATTE_BUFFER_PWR
#define LATTE_BUFFER_PWR 16 // default: 65 536
#endif
static constexpr size_t BUFFER_PWR = LATTE_BUFFER_PWR;
static constexpr size_t MAX_SAMPLES = 1ULL << BUFFER_PWR;
static constexpr size_t BUFFER_MASK = MAX_SAMPLES - 1;
A static_assert(LATTE_BUFFER_PWR >= 4 && LATTE_BUFFER_PWR <= 24, ...) guards against nonsensical values.
Acceptance Criteria
Motivation
The buffer size is hardcoded as
BUFFER_PWR = 16(65 536 samples per ID per thread). This is a poor fit for two common situations:Proposed Change
A
static_assert(LATTE_BUFFER_PWR >= 4 && LATTE_BUFFER_PWR <= 24, ...)guards against nonsensical values.Acceptance Criteria
LATTE_BUFFER_PWRrespected when defined before#include "Latte.hpp"static_assertwith a clear message for out-of-range valuesspeedtest.cppandtestcase.cppstill compile and pass at default power