Add stats for arenas.bin.i.nshards.

This commit is contained in:
Qi Wang 2018-11-21 11:17:31 -08:00 committed by Qi Wang
parent 3f9f2833f6
commit 45bb4483ba
3 changed files with 13 additions and 2 deletions

View File

@ -127,6 +127,7 @@ INDEX_PROTO(arena_i)
CTL_PROTO(arenas_bin_i_size) CTL_PROTO(arenas_bin_i_size)
CTL_PROTO(arenas_bin_i_nregs) CTL_PROTO(arenas_bin_i_nregs)
CTL_PROTO(arenas_bin_i_slab_size) CTL_PROTO(arenas_bin_i_slab_size)
CTL_PROTO(arenas_bin_i_nshards)
INDEX_PROTO(arenas_bin_i) INDEX_PROTO(arenas_bin_i)
CTL_PROTO(arenas_lextent_i_size) CTL_PROTO(arenas_lextent_i_size)
INDEX_PROTO(arenas_lextent_i) INDEX_PROTO(arenas_lextent_i)
@ -355,7 +356,8 @@ static const ctl_indexed_node_t arena_node[] = {
static const ctl_named_node_t arenas_bin_i_node[] = { static const ctl_named_node_t arenas_bin_i_node[] = {
{NAME("size"), CTL(arenas_bin_i_size)}, {NAME("size"), CTL(arenas_bin_i_size)},
{NAME("nregs"), CTL(arenas_bin_i_nregs)}, {NAME("nregs"), CTL(arenas_bin_i_nregs)},
{NAME("slab_size"), CTL(arenas_bin_i_slab_size)} {NAME("slab_size"), CTL(arenas_bin_i_slab_size)},
{NAME("nshards"), CTL(arenas_bin_i_nshards)}
}; };
static const ctl_named_node_t super_arenas_bin_i_node[] = { static const ctl_named_node_t super_arenas_bin_i_node[] = {
{NAME(""), CHILD(named, arenas_bin_i)} {NAME(""), CHILD(named, arenas_bin_i)}
@ -2490,6 +2492,7 @@ CTL_RO_NL_GEN(arenas_nhbins, nhbins, unsigned)
CTL_RO_NL_GEN(arenas_bin_i_size, bin_infos[mib[2]].reg_size, size_t) CTL_RO_NL_GEN(arenas_bin_i_size, bin_infos[mib[2]].reg_size, size_t)
CTL_RO_NL_GEN(arenas_bin_i_nregs, bin_infos[mib[2]].nregs, uint32_t) CTL_RO_NL_GEN(arenas_bin_i_nregs, bin_infos[mib[2]].nregs, uint32_t)
CTL_RO_NL_GEN(arenas_bin_i_slab_size, bin_infos[mib[2]].slab_size, size_t) CTL_RO_NL_GEN(arenas_bin_i_slab_size, bin_infos[mib[2]].slab_size, size_t)
CTL_RO_NL_GEN(arenas_bin_i_nshards, bin_infos[mib[2]].n_shards, uint32_t)
static const ctl_named_node_t * static const ctl_named_node_t *
arenas_bin_i_index(tsdn_t *tsdn, const size_t *mib, arenas_bin_i_index(tsdn_t *tsdn, const size_t *mib,
size_t miblen, size_t i) { size_t miblen, size_t i) {

View File

@ -249,6 +249,7 @@ stats_arena_bins_print(emitter_t *emitter, bool mutex, unsigned i) {
COL(nmalloc, right, 13, uint64) COL(nmalloc, right, 13, uint64)
COL(ndalloc, right, 13, uint64) COL(ndalloc, right, 13, uint64)
COL(nrequests, right, 13, uint64) COL(nrequests, right, 13, uint64)
COL(nshards, right, 9, unsigned)
COL(curregs, right, 13, size) COL(curregs, right, 13, size)
COL(curslabs, right, 13, size) COL(curslabs, right, 13, size)
COL(regs, right, 5, unsigned) COL(regs, right, 5, unsigned)
@ -293,7 +294,7 @@ stats_arena_bins_print(emitter_t *emitter, bool mutex, unsigned i) {
uint64_t nslabs; uint64_t nslabs;
size_t reg_size, slab_size, curregs; size_t reg_size, slab_size, curregs;
size_t curslabs; size_t curslabs;
uint32_t nregs; uint32_t nregs, nshards;
uint64_t nmalloc, ndalloc, nrequests, nfills, nflushes; uint64_t nmalloc, ndalloc, nrequests, nfills, nflushes;
uint64_t nreslabs; uint64_t nreslabs;
@ -310,6 +311,7 @@ stats_arena_bins_print(emitter_t *emitter, bool mutex, unsigned i) {
CTL_M2_GET("arenas.bin.0.size", j, &reg_size, size_t); CTL_M2_GET("arenas.bin.0.size", j, &reg_size, size_t);
CTL_M2_GET("arenas.bin.0.nregs", j, &nregs, uint32_t); CTL_M2_GET("arenas.bin.0.nregs", j, &nregs, uint32_t);
CTL_M2_GET("arenas.bin.0.slab_size", j, &slab_size, size_t); CTL_M2_GET("arenas.bin.0.slab_size", j, &slab_size, size_t);
CTL_M2_GET("arenas.bin.0.nshards", j, &nshards, uint32_t);
CTL_M2_M4_GET("stats.arenas.0.bins.0.nmalloc", i, j, &nmalloc, CTL_M2_M4_GET("stats.arenas.0.bins.0.nmalloc", i, j, &nmalloc,
uint64_t); uint64_t);
@ -383,6 +385,7 @@ stats_arena_bins_print(emitter_t *emitter, bool mutex, unsigned i) {
col_nmalloc.uint64_val = nmalloc; col_nmalloc.uint64_val = nmalloc;
col_ndalloc.uint64_val = ndalloc; col_ndalloc.uint64_val = ndalloc;
col_nrequests.uint64_val = nrequests; col_nrequests.uint64_val = nrequests;
col_nshards.unsigned_val = nshards;
col_curregs.size_val = curregs; col_curregs.size_val = curregs;
col_curslabs.size_val = curslabs; col_curslabs.size_val = curslabs;
col_regs.unsigned_val = nregs; col_regs.unsigned_val = nregs;
@ -1143,6 +1146,10 @@ stats_general_print(emitter_t *emitter) {
emitter_json_kv(emitter, "slab_size", emitter_type_size, emitter_json_kv(emitter, "slab_size", emitter_type_size,
&sv); &sv);
CTL_M2_GET("arenas.bin.0.nshards", i, &u32v, uint32_t);
emitter_json_kv(emitter, "nshards", emitter_type_uint32,
&u32v);
emitter_json_object_end(emitter); emitter_json_object_end(emitter);
} }
emitter_json_array_end(emitter); /* Close "bin". */ emitter_json_array_end(emitter); /* Close "bin". */

View File

@ -706,6 +706,7 @@ TEST_BEGIN(test_arenas_bin_constants) {
TEST_ARENAS_BIN_CONSTANT(uint32_t, nregs, bin_infos[0].nregs); TEST_ARENAS_BIN_CONSTANT(uint32_t, nregs, bin_infos[0].nregs);
TEST_ARENAS_BIN_CONSTANT(size_t, slab_size, TEST_ARENAS_BIN_CONSTANT(size_t, slab_size,
bin_infos[0].slab_size); bin_infos[0].slab_size);
TEST_ARENAS_BIN_CONSTANT(uint32_t, nshards, bin_infos[0].n_shards);
#undef TEST_ARENAS_BIN_CONSTANT #undef TEST_ARENAS_BIN_CONSTANT
} }