| 598 | } |
| 599 | |
| 600 | void |
| 601 | tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena) { |
| 602 | unsigned i; |
| 603 | |
| 604 | cassert(config_stats); |
| 605 | |
| 606 | /* Merge and reset tcache stats. */ |
| 607 | for (i = 0; i < SC_NBINS; i++) { |
| 608 | cache_bin_t *tbin = tcache_small_bin_get(tcache, i); |
| 609 | unsigned binshard; |
| 610 | bin_t *bin = arena_bin_choose_lock(tsdn, arena, i, &binshard); |
| 611 | bin->stats.nrequests += tbin->tstats.nrequests; |
| 612 | malloc_mutex_unlock(tsdn, &bin->lock); |
| 613 | tbin->tstats.nrequests = 0; |
| 614 | } |
| 615 | |
| 616 | for (; i < nhbins; i++) { |
| 617 | cache_bin_t *tbin = tcache_large_bin_get(tcache, i); |
| 618 | arena_stats_large_flush_nrequests_add(tsdn, &arena->stats, i, |
| 619 | tbin->tstats.nrequests); |
| 620 | tbin->tstats.nrequests = 0; |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | static bool |
| 625 | tcaches_create_prep(tsd_t *tsd) { |
no test coverage detected