mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-08-23 07:54:46 +03:00
new approximation for merged peak stats
This commit is contained in:
parent
189b0ac416
commit
1f3a03e931
1 changed files with 7 additions and 2 deletions
|
@ -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) {
|
||||
if (stat==src) return;
|
||||
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
|
||||
mi_atomic_void_addi64_relaxed( &stat->peak, &src->peak);
|
||||
//mi_atomic_void_addi64_relaxed( &stat->peak, &src->peak);
|
||||
// or, take the max?
|
||||
// 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue