must be thread safe as it is called from stats_merge
| 72 | |
| 73 | // must be thread safe as it is called from stats_merge |
| 74 | static void mi_stat_add(mi_stat_count_t* stat, const mi_stat_count_t* src, int64_t unit) { |
| 75 | if (stat==src) return; |
| 76 | if (src->allocated==0 && src->freed==0) return; |
| 77 | mi_atomic_addi64_relaxed( &stat->allocated, src->allocated * unit); |
| 78 | mi_atomic_addi64_relaxed( &stat->current, src->current * unit); |
| 79 | mi_atomic_addi64_relaxed( &stat->freed, src->freed * unit); |
| 80 | // peak scores do not work across threads.. |
| 81 | mi_atomic_addi64_relaxed( &stat->peak, src->peak * unit); |
| 82 | } |
| 83 | |
| 84 | static void mi_stat_counter_add(mi_stat_counter_t* stat, const mi_stat_counter_t* src, int64_t unit) { |
| 85 | if (stat==src) return; |
no test coverage detected