Output total_wait_ns for bin mutexes.

This commit is contained in:
Qi Wang 2017-05-30 15:56:01 -07:00 committed by Qi Wang
parent ff8062a511
commit 2e4d1a4e30

View File

@ -131,7 +131,7 @@ stats_arena_bins_print(void (*write_cb)(void *, const char *), void *cbopaque,
"\t\t\t\t\"bins\": [\n"); "\t\t\t\t\"bins\": [\n");
} else { } else {
char *mutex_counters = " n_lock_ops n_waiting" char *mutex_counters = " n_lock_ops n_waiting"
" n_spin_acq max_wait_ns\n"; " n_spin_acq total_wait_ns max_wait_ns\n";
malloc_cprintf(write_cb, cbopaque, malloc_cprintf(write_cb, cbopaque,
"bins: size ind allocated nmalloc" "bins: size ind allocated nmalloc"
" ndalloc nrequests curregs curslabs regs" " ndalloc nrequests curregs curslabs regs"
@ -221,28 +221,11 @@ stats_arena_bins_print(void (*write_cb)(void *, const char *), void *cbopaque,
not_reached(); not_reached();
} }
} }
/* Output less info for bin mutexes to save space. */
uint64_t num_ops, num_wait, max_wait;
CTL_M2_M4_GET("stats.arenas.0.bins.0.mutex.num_wait",
i, j, &num_wait, uint64_t);
CTL_M2_M4_GET(
"stats.arenas.0.bins.0.mutex.max_wait_time", i, j,
&max_wait, uint64_t);
CTL_M2_M4_GET("stats.arenas.0.bins.0.mutex.num_ops",
i, j, &num_ops, uint64_t);
uint64_t mutex_stats[mutex_prof_num_counters]; uint64_t mutex_stats[mutex_prof_num_counters];
if (mutex) { if (mutex) {
read_arena_bin_mutex_stats(i, j, mutex_stats); read_arena_bin_mutex_stats(i, j, mutex_stats);
} }
char rate[6];
if (get_rate_str(num_wait, num_ops, rate)) {
if (num_ops == 0) {
malloc_snprintf(rate, sizeof(rate),
"0");
}
}
malloc_cprintf(write_cb, cbopaque, "%20zu %3u %12zu %12" malloc_cprintf(write_cb, cbopaque, "%20zu %3u %12zu %12"
FMTu64" %12"FMTu64" %12"FMTu64" %12zu %12zu %4u" FMTu64" %12"FMTu64" %12"FMTu64" %12zu %12zu %4u"
" %3zu %-5s %12"FMTu64" %12"FMTu64" %12"FMTu64 " %3zu %-5s %12"FMTu64" %12"FMTu64" %12"FMTu64
@ -250,13 +233,16 @@ stats_arena_bins_print(void (*write_cb)(void *, const char *), void *cbopaque,
nmalloc, ndalloc, nrequests, curregs, curslabs, nmalloc, ndalloc, nrequests, curregs, curslabs,
nregs, slab_size / page, util, nfills, nflushes, nregs, slab_size / page, util, nfills, nflushes,
nslabs, nreslabs); nslabs, nreslabs);
/* Output less info for bin mutexes to save space. */
if (mutex) { if (mutex) {
malloc_cprintf(write_cb, cbopaque, malloc_cprintf(write_cb, cbopaque,
" %12"FMTu64" %12"FMTu64" %12"FMTu64 " %12"FMTu64" %12"FMTu64" %12"FMTu64
" %12"FMTu64"\n", " %14"FMTu64" %12"FMTu64"\n",
mutex_stats[mutex_counter_num_ops], mutex_stats[mutex_counter_num_ops],
mutex_stats[mutex_counter_num_wait], mutex_stats[mutex_counter_num_wait],
mutex_stats[mutex_counter_num_spin_acq], mutex_stats[mutex_counter_num_spin_acq],
mutex_stats[mutex_counter_total_wait_time],
mutex_stats[mutex_counter_max_wait_time]); mutex_stats[mutex_counter_max_wait_time]);
} else { } else {
malloc_cprintf(write_cb, cbopaque, "\n"); malloc_cprintf(write_cb, cbopaque, "\n");