summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2012-03-07 17:02:41 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2012-03-20 11:20:53 +1100
commit038c946e80b9f710e5949876bbd763033ab8e5ce (patch)
tree00db388a14e11bab6d949457188e5dc760d2ad9e
parentb3ddf6901d1f4706731771606f466da4c6165fd9 (diff)
downloadsamba-038c946e80b9f710e5949876bbd763033ab8e5ce.tar.gz
samba-038c946e80b9f710e5949876bbd763033ab8e5ce.tar.xz
samba-038c946e80b9f710e5949876bbd763033ab8e5ce.zip
add max hop count buckets to see how bad hopcounts are
(This used to be ctdb commit 7d3931298e6477d92f43652c3006b0c426cb1307)
-rw-r--r--ctdb/include/ctdb_protocol.h2
-rw-r--r--ctdb/server/ctdb_call.c12
-rw-r--r--ctdb/tools/ctdb.c6
3 files changed, 20 insertions, 0 deletions
diff --git a/ctdb/include/ctdb_protocol.h b/ctdb/include/ctdb_protocol.h
index 3e466d83db..6c1cc64752 100644
--- a/ctdb/include/ctdb_protocol.h
+++ b/ctdb/include/ctdb_protocol.h
@@ -646,6 +646,8 @@ 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];
struct latency_counter call_latency;
struct latency_counter lockwait_latency;
struct latency_counter childwrite_latency;
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index 50f4cb2e1f..7e61710340 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -465,6 +465,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
struct ctdb_ltdb_header header;
struct ctdb_call *call;
struct ctdb_db_context *ctdb_db;
+ int tmp_count, bucket;
if (ctdb->methods == NULL) {
DEBUG(DEBUG_INFO,(__location__ " Failed ctdb_request_call. Transport is DOWN\n"));
@@ -629,6 +630,17 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
}
CTDB_UPDATE_STAT(ctdb, max_hop_count, c->hopcount);
+ tmp_count = c->hopcount;
+ bucket = 0;
+ while (tmp_count) {
+ tmp_count >>= 2;
+ bucket++;
+ }
+ if (bucket >= MAX_HOP_COUNT_BUCKETS) {
+ bucket = MAX_HOP_COUNT_BUCKETS - 1;
+ }
+ CTDB_INCREMENT_STAT(ctdb, hop_count_bucket[bucket]);
+
/* Try if possible to migrate the record off to the caller node.
* From the clients perspective a fetch of the data is just as
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 756671b75d..3f11207273 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -346,6 +346,7 @@ static void show_statistics(struct ctdb_statistics *s, int show_header)
STATISTICS_FIELD(total_ro_delegations),
STATISTICS_FIELD(total_ro_revokes),
};
+
tmp = s->statistics_current_time.tv_sec - s->statistics_start_time.tv_sec;
seconds = tmp%60;
tmp /= 60;
@@ -441,6 +442,11 @@ static void show_statistics(struct ctdb_statistics *s, int show_header)
preflen?0:4, "",
*(uint32_t *)(fields[i].offset+(uint8_t *)s));
}
+ printf("Max hop count buckets:");
+ for (i=0;i<MAX_HOP_COUNT_BUCKETS;i++) {
+ printf(" %d", s->hop_count_bucket[i]);
+ }
+ printf("\n");
printf(" %-30s %.6f/%.6f/%.6f sec out of %d\n", "reclock_ctdbd MIN/AVG/MAX", s->reclock.ctdbd.min, s->reclock.ctdbd.num?s->reclock.ctdbd.total/s->reclock.ctdbd.num:0.0, s->reclock.ctdbd.max, s->reclock.ctdbd.num);
printf(" %-30s %.6f/%.6f/%.6f sec out of %d\n", "reclock_recd MIN/AVG/MAX", s->reclock.recd.min, s->reclock.recd.num?s->reclock.recd.total/s->reclock.recd.num:0.0, s->reclock.recd.max, s->reclock.recd.num);