| 526 | } |
| 527 | |
| 528 | void |
| 529 | tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena) { |
| 530 | unsigned i; |
| 531 | |
| 532 | cassert(config_stats); |
| 533 | |
| 534 | /* Merge and reset tcache stats. */ |
| 535 | for (i = 0; i < NBINS; i++) { |
| 536 | bin_t *bin = &arena->bins[i]; |
| 537 | cache_bin_t *tbin = tcache_small_bin_get(tcache, i); |
| 538 | malloc_mutex_lock(tsdn, &bin->lock); |
| 539 | bin->stats.nrequests += tbin->tstats.nrequests; |
| 540 | malloc_mutex_unlock(tsdn, &bin->lock); |
| 541 | tbin->tstats.nrequests = 0; |
| 542 | } |
| 543 | |
| 544 | for (; i < nhbins; i++) { |
| 545 | cache_bin_t *tbin = tcache_large_bin_get(tcache, i); |
| 546 | arena_stats_large_nrequests_add(tsdn, &arena->stats, i, |
| 547 | tbin->tstats.nrequests); |
| 548 | tbin->tstats.nrequests = 0; |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | static bool |
| 553 | tcaches_create_prep(tsd_t *tsd) { |
no test coverage detected