This commit is contained in:
Artem Kharytoniuk 2025-07-10 13:50:30 +02:00 committed by GitHub
commit 5dfc8ed6ad
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: B5690EEEBB952194

View file

@ -86,11 +86,16 @@ void _mi_stat_adjust_decrease(mi_stat_count_t* stat, size_t amount) {
static void mi_stat_count_add_mt(mi_stat_count_t* stat, const mi_stat_count_t* src) { static void mi_stat_count_add_mt(mi_stat_count_t* stat, const mi_stat_count_t* src) {
if (stat==src) return; if (stat==src) return;
mi_atomic_void_addi64_relaxed(&stat->total, &src->total); mi_atomic_void_addi64_relaxed(&stat->total, &src->total);
mi_atomic_void_addi64_relaxed(&stat->current, &src->current);
int64_t prev_current = mi_atomic_addi64_relaxed(&stat->current, src->current);
// peak scores do really not work across threads .. we just add them // peak scores do really not work across threads .. we just add them
mi_atomic_void_addi64_relaxed( &stat->peak, &src->peak); //mi_atomic_void_addi64_relaxed( &stat->peak, &src->peak);
// or, take the max? // or, take the max?
// mi_atomic_maxi64_relaxed(&stat->peak, src->peak); // mi_atomic_maxi64_relaxed(&stat->peak, src->peak);
// global current plus thread peak approximates new global peak
mi_atomic_maxi64_relaxed(&stat->peak, prev_current + src->peak);
} }
static void mi_stat_counter_add_mt(mi_stat_counter_t* stat, const mi_stat_counter_t* src) { static void mi_stat_counter_add_mt(mi_stat_counter_t* stat, const mi_stat_counter_t* src) {