mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Add dbg_clear helper function
closes https://github.com/official-stockfish/Stockfish/pull/5921 No functional change
This commit is contained in:
+14
-1
@@ -287,12 +287,18 @@ namespace {
|
|||||||
|
|
||||||
template<size_t N>
|
template<size_t N>
|
||||||
struct DebugInfo {
|
struct DebugInfo {
|
||||||
std::atomic<int64_t> data[N] = {0};
|
std::array<std::atomic<int64_t>, N> data = {0};
|
||||||
|
|
||||||
[[nodiscard]] constexpr std::atomic<int64_t>& operator[](size_t index) {
|
[[nodiscard]] constexpr std::atomic<int64_t>& operator[](size_t index) {
|
||||||
assert(index < N);
|
assert(index < N);
|
||||||
return data[index];
|
return data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr DebugInfo& operator=(const DebugInfo& other) {
|
||||||
|
for (size_t i = 0; i < N; i++)
|
||||||
|
data[i].store(other.data[i].load());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DebugExtremes: public DebugInfo<3> {
|
struct DebugExtremes: public DebugInfo<3> {
|
||||||
@@ -393,6 +399,13 @@ void dbg_print() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dbg_clear() {
|
||||||
|
hit.fill({});
|
||||||
|
mean.fill({});
|
||||||
|
stdev.fill({});
|
||||||
|
correl.fill({});
|
||||||
|
extremes.fill({});
|
||||||
|
}
|
||||||
|
|
||||||
// Used to serialize access to std::cout
|
// Used to serialize access to std::cout
|
||||||
// to avoid multiple threads writing at the same time.
|
// to avoid multiple threads writing at the same time.
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ void dbg_stdev_of(int64_t value, int slot = 0);
|
|||||||
void dbg_extremes_of(int64_t value, int slot = 0);
|
void dbg_extremes_of(int64_t value, int slot = 0);
|
||||||
void dbg_correl_of(int64_t value1, int64_t value2, int slot = 0);
|
void dbg_correl_of(int64_t value1, int64_t value2, int slot = 0);
|
||||||
void dbg_print();
|
void dbg_print();
|
||||||
|
void dbg_clear();
|
||||||
|
|
||||||
using TimePoint = std::chrono::milliseconds::rep; // A value in milliseconds
|
using TimePoint = std::chrono::milliseconds::rep; // A value in milliseconds
|
||||||
static_assert(sizeof(TimePoint) == sizeof(int64_t), "TimePoint should be 64 bits");
|
static_assert(sizeof(TimePoint) == sizeof(int64_t), "TimePoint should be 64 bits");
|
||||||
|
|||||||
Reference in New Issue
Block a user