Skip to content

Commit bdaeb1d

Browse files
committed
remove stat_adjust
1 parent 113800d commit bdaeb1d

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

include/mimalloc/types.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -612,24 +612,17 @@ typedef struct mi_stats_s {
612612
// add to stat keeping track of the peak
613613
void _mi_stat_increase(mi_stat_count_t* stat, size_t amount);
614614
void _mi_stat_decrease(mi_stat_count_t* stat, size_t amount);
615-
// adjust stat in special cases to compensate for double counting
616-
void _mi_stat_adjust_increase(mi_stat_count_t* stat, size_t amount);
617-
void _mi_stat_adjust_decrease(mi_stat_count_t* stat, size_t amount);
618615
// counters can just be increased
619616
void _mi_stat_counter_increase(mi_stat_counter_t* stat, size_t amount);
620617

621618
#if (MI_STAT)
622619
#define mi_stat_increase(stat,amount) _mi_stat_increase( &(stat), amount)
623620
#define mi_stat_decrease(stat,amount) _mi_stat_decrease( &(stat), amount)
624621
#define mi_stat_counter_increase(stat,amount) _mi_stat_counter_increase( &(stat), amount)
625-
#define mi_stat_adjust_increase(stat,amount) _mi_stat_adjust_increase( &(stat), amount)
626-
#define mi_stat_adjust_decrease(stat,amount) _mi_stat_adjust_decrease( &(stat), amount)
627622
#else
628623
#define mi_stat_increase(stat,amount) ((void)0)
629624
#define mi_stat_decrease(stat,amount) ((void)0)
630625
#define mi_stat_counter_increase(stat,amount) ((void)0)
631-
#define mi_stat_adjuct_increase(stat,amount) ((void)0)
632-
#define mi_stat_adjust_decrease(stat,amount) ((void)0)
633626
#endif
634627

635628
#define mi_heap_stat_counter_increase(heap,stat,amount) mi_stat_counter_increase( (heap)->tld->stats.stat, amount)

src/stats.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,6 @@ static void mi_stat_update(mi_stat_count_t* stat, int64_t amount) {
5151
}
5252
}
5353

54-
// Adjust stats to compensate; for example before committing a range,
55-
// first adjust downwards with parts that were already committed so
56-
// we avoid double counting.
57-
static void mi_stat_adjust(mi_stat_count_t* stat, int64_t amount) {
58-
if (amount == 0) return;
59-
if mi_unlikely(mi_is_in_main(stat))
60-
{
61-
// adjust atomically
62-
mi_atomic_addi64_relaxed(&stat->current, amount);
63-
mi_atomic_addi64_relaxed(&stat->allocated, amount);
64-
mi_atomic_addi64_relaxed(&stat->freed, amount);
65-
}
66-
else {
67-
// don't affect the peak
68-
stat->current += amount;
69-
// add to both
70-
stat->allocated += amount;
71-
stat->freed += amount;
72-
}
73-
}
74-
7554
void _mi_stat_counter_increase(mi_stat_counter_t* stat, size_t amount) {
7655
if (mi_is_in_main(stat)) {
7756
mi_atomic_addi64_relaxed( &stat->count, 1 );
@@ -91,13 +70,7 @@ void _mi_stat_decrease(mi_stat_count_t* stat, size_t amount) {
9170
mi_stat_update(stat, -((int64_t)amount));
9271
}
9372

94-
void _mi_stat_adjust_increase(mi_stat_count_t* stat, size_t amount) {
95-
mi_stat_adjust(stat, (int64_t)amount);
96-
}
9773

98-
void _mi_stat_adjust_decrease(mi_stat_count_t* stat, size_t amount) {
99-
mi_stat_adjust(stat, -((int64_t)amount));
100-
}
10174

10275
// must be thread safe as it is called from stats_merge
10376
static void mi_stat_add(mi_stat_count_t* stat, const mi_stat_count_t* src, int64_t unit) {

0 commit comments

Comments
 (0)