MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_stat_add

Function mi_stat_add

3rd/mimalloc-2.0.9/src/stats.c:74–82  ·  view source on GitHub ↗

must be thread safe as it is called from stats_merge

Source from the content-addressed store, hash-verified

72
73// must be thread safe as it is called from stats_merge
74static 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
84static void mi_stat_counter_add(mi_stat_counter_t* stat, const mi_stat_counter_t* src, int64_t unit) {
85 if (stat==src) return;

Callers 2

mi_stats_addFunction · 0.85
_mi_stats_printFunction · 0.85

Calls 1

mi_atomic_addi64_relaxedFunction · 0.85

Tested by

no test coverage detected