summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2012-03-20 12:08:12 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2012-03-20 12:11:55 +1100
commit6a493a0b08a8751ee9265047152851e00b9bf443 (patch)
tree9ff32dff2f2ec0a1bb42936970fb788fcbfc1144 /ctdb
parentc9f7c981e265765d2c7825ce5083831e123989df (diff)
downloadsamba-6a493a0b08a8751ee9265047152851e00b9bf443.tar.gz
STATISTICS: add per-db hop count statistics
(This used to be ctdb commit 1c976d83b1d7dac6f0ef81306774998e4c8b56a1)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/include/ctdb_protocol.h6
-rw-r--r--ctdb/server/ctdb_call.c5
-rw-r--r--ctdb/tools/ctdb.c7
3 files changed, 13 insertions, 5 deletions
diff --git a/ctdb/include/ctdb_protocol.h b/ctdb/include/ctdb_protocol.h
index 6c1cc647529..ec52f5626c7 100644
--- a/ctdb/include/ctdb_protocol.h
+++ b/ctdb/include/ctdb_protocol.h
@@ -603,6 +603,8 @@ struct ctdb_traverse_start_ext {
/*
ctdb statistics information
*/
+#define MAX_COUNT_BUCKETS 16
+
struct ctdb_statistics {
uint32_t num_clients;
uint32_t frozen;
@@ -646,8 +648,7 @@ struct ctdb_statistics {
uint32_t memory_used;
uint32_t __last_counter; /* hack for control_statistics_all */
uint32_t max_hop_count;
-#define MAX_HOP_COUNT_BUCKETS 16
- uint32_t hop_count_bucket[MAX_HOP_COUNT_BUCKETS];
+ uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
struct latency_counter call_latency;
struct latency_counter lockwait_latency;
struct latency_counter childwrite_latency;
@@ -672,6 +673,7 @@ struct ctdb_statistics_wire {
struct ctdb_db_statistics {
uint32_t db_ro_delegations;
uint32_t db_ro_revokes;
+ uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
};
/*
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index 7e617103409..c015fbfff66 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -636,10 +636,11 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
tmp_count >>= 2;
bucket++;
}
- if (bucket >= MAX_HOP_COUNT_BUCKETS) {
- bucket = MAX_HOP_COUNT_BUCKETS - 1;
+ if (bucket >= MAX_COUNT_BUCKETS) {
+ bucket = MAX_COUNT_BUCKETS - 1;
}
CTDB_INCREMENT_STAT(ctdb, hop_count_bucket[bucket]);
+ CTDB_INCREMENT_DB_STAT(ctdb_db, hop_count_bucket[bucket]);
/* Try if possible to migrate the record off to the caller node.
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 28b6e8fc3a0..893d91fb23b 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -443,7 +443,7 @@ static void show_statistics(struct ctdb_statistics *s, int show_header)
*(uint32_t *)(fields[i].offset+(uint8_t *)s));
}
printf(" hop_count_buckets:");
- for (i=0;i<MAX_HOP_COUNT_BUCKETS;i++) {
+ for (i=0;i<MAX_COUNT_BUCKETS;i++) {
printf(" %d", s->hop_count_bucket[i]);
}
printf("\n");
@@ -615,6 +615,11 @@ static int control_dbstatistics(struct ctdb_context *ctdb, int argc, const char
printf("DB Statistics:\n");
printf("RO Delegations: %d\n", dbstatistics->db_ro_delegations);
printf("RO Revokes: %d\n", dbstatistics->db_ro_revokes);
+ printf(" hop_count_buckets:");
+ for (i=0;i<MAX_COUNT_BUCKETS;i++) {
+ printf(" %d", dbstatistics->hop_count_bucket[i]);
+ }
+ printf("\n");
ctdb_free_dbstat(dbstatistics);
return 0;