The repository had no licence at all, so every source was all-rights-reserved by default. Add the verbatim MIT text at LICENSE (Copyright (c) 2026 Martino Ferrari) and a two-line SPDX header to each of the 113 first-party sources -- 48 include/plot, 26 src, 10 adapters, 5 examples, 21 tests, 3 tools -- so the grant travels with each file rather than relying on the root document alone. Scripts keep their shebang on line 1; the SPDX lines follow it. Genuinely vendored code is untouched: third_party/stb_truetype.h carries no header of ours. src/render/embedded_mono_font.cpp is generated, so tools/fonts/gen_atlas.py emit() now writes the two lines into its header comment and the file was regenerated -- gen_atlas.py --check passes and the regeneration adds only those comment lines to the previously committed file. README's provenance section now states MIT and links LICENSE. No code, test or public API change.
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
// SPDX-License-Identifier: MIT
|
|
// SPDX-FileCopyrightText: 2026 Martino Ferrari
|
|
|
|
#pragma once
|
|
|
|
#ifdef PLOT_PYRAMID_COUNT_MERGES
|
|
|
|
#include <atomic>
|
|
|
|
#include <plot/core/types.hpp>
|
|
|
|
namespace plot::data::detail {
|
|
|
|
/// Test-only instrumentation. Counts the bucket merges the append path has
|
|
/// performed since the counter was last reset: one for the bucket pushed at
|
|
/// level 0 when it completes, plus one for every parent bucket written above it.
|
|
///
|
|
/// The append path's *cost* is invisible in every answer -- a pyramid that walks
|
|
/// every live level per sample returns exactly the same min/max/sum as one that
|
|
/// stops at the first level that gained no entry -- so a test that wants to pin
|
|
/// "amortised O(1) per sample, independent of the number of live levels" has to
|
|
/// count merges. The counter exists only when PLOT_PYRAMID_COUNT_MERGES is
|
|
/// defined (the test build defines it), so every normal build carries no counter
|
|
/// and no increment on the append path.
|
|
///
|
|
/// Not part of the query surface and not meant for production use.
|
|
inline std::atomic<u64>& merge_count() {
|
|
static std::atomic<u64> count{0};
|
|
return count;
|
|
}
|
|
|
|
} // namespace plot::data::detail
|
|
|
|
#endif // PLOT_PYRAMID_COUNT_MERGES
|