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

Function mi_stat_update

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

Source from the content-addressed store, hash-verified

25}
26
27static void mi_stat_update(mi_stat_count_t* stat, int64_t amount) {
28 if (amount == 0) return;
29 if (mi_is_in_main(stat))
30 {
31 // add atomically (for abandoned pages)
32 int64_t current = mi_atomic_addi64_relaxed(&stat->current, amount);
33 mi_atomic_maxi64_relaxed(&stat->peak, current + amount);
34 if (amount > 0) {
35 mi_atomic_addi64_relaxed(&stat->allocated,amount);
36 }
37 else {
38 mi_atomic_addi64_relaxed(&stat->freed, -amount);
39 }
40 }
41 else {
42 // add thread local
43 stat->current += amount;
44 if (stat->current > stat->peak) stat->peak = stat->current;
45 if (amount > 0) {
46 stat->allocated += amount;
47 }
48 else {
49 stat->freed += -amount;
50 }
51 }
52}
53
54void _mi_stat_counter_increase(mi_stat_counter_t* stat, size_t amount) {
55 if (mi_is_in_main(stat)) {

Callers 2

_mi_stat_increaseFunction · 0.85
_mi_stat_decreaseFunction · 0.85

Calls 3

mi_is_in_mainFunction · 0.85
mi_atomic_addi64_relaxedFunction · 0.85
mi_atomic_maxi64_relaxedFunction · 0.85

Tested by

no test coverage detected