[SCM] CTDB repository - branch 1.2 updated - ctdb-1.0.114-339-g57cbf7b

Ronnie Sahlberg sahlberg at samba.org
Wed Sep 29 23:00:56 MDT 2010


The branch, 1.2 has been updated
       via  57cbf7b3db9a71a1bafc5fc17b2b44bb0508f73e (commit)
       via  3bf203a895ff348f060e5f58b6e81967b3bfd994 (commit)
      from  22227fc54911c7ca621fd3e8fe11da2cd5645de8 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.2


- Log -----------------------------------------------------------------
commit 57cbf7b3db9a71a1bafc5fc17b2b44bb0508f73e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Sep 30 14:59:59 2010 +1000

    add a machinereadable version of ctdb stats/statistics

commit 3bf203a895ff348f060e5f58b6e81967b3bfd994
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Sep 30 14:39:54 2010 +1000

    Create a tunable for how often to collect rolling statistics and initialize it to 1 second

-----------------------------------------------------------------------

Summary of changes:
 include/ctdb_private.h   |    1 +
 server/ctdb_statistics.c |    5 ++-
 server/ctdb_tunables.c   |    3 +-
 tools/ctdb.c             |   76 ++++++++++++++++++++++++++++++++--------------
 4 files changed, 59 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 6341ab0..15dce9b 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -117,6 +117,7 @@ struct ctdb_tunable {
 	uint32_t max_queue_depth_drop_msg;
 	uint32_t use_status_events_for_monitoring;
 	uint32_t allow_unhealthy_db_read;
+	uint32_t stat_history_interval;
 };
 
 /*
diff --git a/server/ctdb_statistics.c b/server/ctdb_statistics.c
index 243a4f2..aec17ad 100644
--- a/server/ctdb_statistics.c
+++ b/server/ctdb_statistics.c
@@ -35,7 +35,8 @@ static void ctdb_statistics_update(struct event_context *ev, struct timed_event
 	bzero(&ctdb->statistics_current, sizeof(struct ctdb_statistics));
 	ctdb->statistics_current.statistics_start_time = timeval_current();
 
-	event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(10, 0), ctdb_statistics_update, ctdb);
+	
+	event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(ctdb->tunable.stat_history_interval, 0), ctdb_statistics_update, ctdb);
 }
 
 int ctdb_statistics_init(struct ctdb_context *ctdb)
@@ -47,7 +48,7 @@ int ctdb_statistics_init(struct ctdb_context *ctdb)
 
 	bzero(ctdb->statistics_history, sizeof(ctdb->statistics_history));
 
-	event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(10, 0), ctdb_statistics_update, ctdb);
+	event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(ctdb->tunable.stat_history_interval, 0), ctdb_statistics_update, ctdb);
 	return 0;
 }
 
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index cca270b..02e76ae 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -64,7 +64,8 @@ static const struct {
 	{ "VacuumMaxInterval",  600,  offsetof(struct ctdb_tunable, vacuum_max_interval) },
 	{ "MaxQueueDropMsg",  1000000, offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) },
 	{ "UseStatusEvents",     0,  offsetof(struct ctdb_tunable, use_status_events_for_monitoring) },
-	{ "AllowUnhealthyDBRead", 0,  offsetof(struct ctdb_tunable, allow_unhealthy_db_read) }
+	{ "AllowUnhealthyDBRead", 0,  offsetof(struct ctdb_tunable, allow_unhealthy_db_read) },
+	{ "StatHistoryInterval",  1,  offsetof(struct ctdb_tunable, stat_history_interval) }
 };
 
 /*
diff --git a/tools/ctdb.c b/tools/ctdb.c
index fc4d318..d1ec57d 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -211,33 +211,63 @@ static void show_statistics(struct ctdb_statistics *s)
 	tmp    /= 24;
 	days    = tmp;
 
-	printf("CTDB version %u\n", CTDB_VERSION);
-	printf("Current time of statistics  :                %s", ctime(&s->statistics_current_time.tv_sec));
-	printf("Statistics collected since  : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&s->statistics_start_time.tv_sec));
-
-	for (i=0;i<ARRAY_SIZE(fields);i++) {
-		if (strchr(fields[i].name, '.')) {
-			preflen = strcspn(fields[i].name, ".")+1;
-			if (!prefix || strncmp(prefix, fields[i].name, preflen) != 0) {
-				prefix = fields[i].name;
-				printf(" %*.*s\n", preflen-1, preflen-1, fields[i].name);
+	if (options.machinereadable){
+		printf("CTDB version:");
+		printf("Current time of statistics:");
+		printf("Statistics collected since:");
+		for (i=0;i<ARRAY_SIZE(fields);i++) {
+			printf("%s:", fields[i].name);
+		}
+		printf("max_reclock_ctdbd:");
+		printf("max_reclock_recd:");
+		printf("max_call_latency:");
+		printf("max_lockwait_latency:");
+		printf("max_childwrite_latency:");
+		printf("max_childwrite_latency:");
+		printf("\n");
+
+		printf("%d:", CTDB_VERSION);
+		printf("%d:", (int)s->statistics_current_time.tv_sec);
+		printf("%d:", (int)s->statistics_start_time.tv_sec);
+		for (i=0;i<ARRAY_SIZE(fields);i++) {
+			printf("%d:", *(uint32_t *)(fields[i].offset+(uint8_t *)s));
+		}
+		printf("%.6f:", s->reclock.ctdbd);
+		printf("%.6f:", s->reclock.recd);
+		printf("%.6f:", s->max_call_latency);
+		printf("%.6f:", s->max_lockwait_latency);
+		printf("%.6f:", s->max_childwrite_latency);
+		printf("%.6f:", s->max_childwrite_latency);
+		printf("\n");
+	} else {
+		printf("CTDB version %u\n", CTDB_VERSION);
+		printf("Current time of statistics  :                %s", ctime(&s->statistics_current_time.tv_sec));
+		printf("Statistics collected since  : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&s->statistics_start_time.tv_sec));
+
+		for (i=0;i<ARRAY_SIZE(fields);i++) {
+			if (strchr(fields[i].name, '.')) {
+				preflen = strcspn(fields[i].name, ".")+1;
+				if (!prefix || strncmp(prefix, fields[i].name, preflen) != 0) {
+					prefix = fields[i].name;
+					printf(" %*.*s\n", preflen-1, preflen-1, fields[i].name);
+				}
+			} else {
+				preflen = 0;
 			}
-		} else {
-			preflen = 0;
+			printf(" %*s%-22s%*s%10u\n", 
+			       preflen?4:0, "",
+			       fields[i].name+preflen, 
+			       preflen?0:4, "",
+			       *(uint32_t *)(fields[i].offset+(uint8_t *)s));
 		}
-		printf(" %*s%-22s%*s%10u\n", 
-		       preflen?4:0, "",
-		       fields[i].name+preflen, 
-		       preflen?0:4, "",
-		       *(uint32_t *)(fields[i].offset+(uint8_t *)s));
-	}
-	printf(" %-30s     %.6f sec\n", "max_reclock_ctdbd", s->reclock.ctdbd);
-	printf(" %-30s     %.6f sec\n", "max_reclock_recd", s->reclock.recd);
-
-	printf(" %-30s     %.6f sec\n", "max_call_latency", s->max_call_latency);
-	printf(" %-30s     %.6f sec\n", "max_lockwait_latency", s->max_lockwait_latency);
-	printf(" %-30s     %.6f sec\n", "max_childwrite_latency", s->max_childwrite_latency);
-	printf(" %-30s     %.6f sec\n", "max_childwrite_latency", s->max_childwrite_latency);
+		printf(" %-30s     %.6f sec\n", "max_reclock_ctdbd", s->reclock.ctdbd);
+		printf(" %-30s     %.6f sec\n", "max_reclock_recd", s->reclock.recd);
+
+		printf(" %-30s     %.6f sec\n", "max_call_latency", s->max_call_latency);
+		printf(" %-30s     %.6f sec\n", "max_lockwait_latency", s->max_lockwait_latency);
+		printf(" %-30s     %.6f sec\n", "max_childwrite_latency", s->max_childwrite_latency);
+		printf(" %-30s     %.6f sec\n", "max_childwrite_latency", s->max_childwrite_latency);
+	}
 
 	talloc_free(tmp_ctx);
 }


-- 
CTDB repository


More information about the samba-cvs mailing list