must be thread safe as it is called from stats_merge
| 89 | |
| 90 | // must be thread safe as it is called from stats_merge |
| 91 | static void mi_stats_add(mi_stats_t* stats, const mi_stats_t* src) { |
| 92 | if (stats==src) return; |
| 93 | mi_stat_add(&stats->segments, &src->segments,1); |
| 94 | mi_stat_add(&stats->pages, &src->pages,1); |
| 95 | mi_stat_add(&stats->reserved, &src->reserved, 1); |
| 96 | mi_stat_add(&stats->committed, &src->committed, 1); |
| 97 | mi_stat_add(&stats->reset, &src->reset, 1); |
| 98 | mi_stat_add(&stats->page_committed, &src->page_committed, 1); |
| 99 | |
| 100 | mi_stat_add(&stats->pages_abandoned, &src->pages_abandoned, 1); |
| 101 | mi_stat_add(&stats->segments_abandoned, &src->segments_abandoned, 1); |
| 102 | mi_stat_add(&stats->threads, &src->threads, 1); |
| 103 | |
| 104 | mi_stat_add(&stats->malloc, &src->malloc, 1); |
| 105 | mi_stat_add(&stats->segments_cache, &src->segments_cache, 1); |
| 106 | mi_stat_add(&stats->normal, &src->normal, 1); |
| 107 | mi_stat_add(&stats->huge, &src->huge, 1); |
| 108 | mi_stat_add(&stats->large, &src->large, 1); |
| 109 | |
| 110 | mi_stat_counter_add(&stats->pages_extended, &src->pages_extended, 1); |
| 111 | mi_stat_counter_add(&stats->mmap_calls, &src->mmap_calls, 1); |
| 112 | mi_stat_counter_add(&stats->commit_calls, &src->commit_calls, 1); |
| 113 | |
| 114 | mi_stat_counter_add(&stats->page_no_retire, &src->page_no_retire, 1); |
| 115 | mi_stat_counter_add(&stats->searches, &src->searches, 1); |
| 116 | mi_stat_counter_add(&stats->normal_count, &src->normal_count, 1); |
| 117 | mi_stat_counter_add(&stats->huge_count, &src->huge_count, 1); |
| 118 | mi_stat_counter_add(&stats->large_count, &src->large_count, 1); |
| 119 | #if MI_STAT>1 |
| 120 | for (size_t i = 0; i <= MI_BIN_HUGE; i++) { |
| 121 | if (src->normal_bins[i].allocated > 0 || src->normal_bins[i].freed > 0) { |
| 122 | mi_stat_add(&stats->normal_bins[i], &src->normal_bins[i], 1); |
| 123 | } |
| 124 | } |
| 125 | #endif |
| 126 | } |
| 127 | |
| 128 | /* ----------------------------------------------------------- |
| 129 | Display statistics |
no test coverage detected