// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2026 Martino Ferrari #pragma once #ifdef PLOT_PYRAMID_COUNT_COVERS #include #include namespace plot::data::detail { /// Test-only instrumentation. Counts the pyramid entries the covering /// decomposition has emitted since the counter was last reset. /// /// The decomposition's *cost* is invisible in every answer -- a decomposition /// that walks the range one level-0 bucket at a time returns exactly the same /// min/max/sum as the O(log n) one -- so a test that wants to pin "at most two /// entries per level" has to count entries. The counter exists only when /// PLOT_PYRAMID_COUNT_COVERS is defined (the test build defines it), so every /// normal build carries no counter and no increment on the query path. /// /// Not part of the query surface and not meant for production use. inline std::atomic& cover_entry_count() { static std::atomic count{0}; return count; } } // namespace plot::data::detail #endif // PLOT_PYRAMID_COUNT_COVERS