From 16b519c51b27f562b0a0f5a6fc8d20c2eb0b8978 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 15 Jul 2013 16:35:30 +1000 Subject: [PATCH] tools/ctdb: Only print the hot records with non-zero hopcount Signed-off-by: Amitay Isaacs (This used to be ctdb commit 049d9beb3783482490e6273a434ccbad23f85f0a) --- ctdb/tools/ctdb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 4c047257b23..ee603748962 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -604,6 +604,7 @@ static int control_dbstatistics(struct ctdb_context *ctdb, int argc, const char struct ctdb_db_statistics *dbstat; int i; uint32_t db_id; + int num_hot_keys; if (argc < 1) { usage(); @@ -651,6 +652,14 @@ static int control_dbstatistics(struct ctdb_context *ctdb, int argc, const char 0.0), dbstat->locks.latency.max, dbstat->locks.latency.num); + num_hot_keys = 0; + for (i=0; inum_hot_keys; i++) { + if (dbstat->hot_keys[i].count > 0) { + num_hot_keys++; + } + } + dbstat->num_hot_keys = num_hot_keys; + printf(" Num Hot Keys: %d\n", dbstat->num_hot_keys); for (i = 0; i < dbstat->num_hot_keys; i++) { int j;