[SCM] CTDB repository - branch master updated - ctdb-1.0.114-324-g3a03315
Ronnie Sahlberg
sahlberg at samba.org
Wed Sep 29 23:00:57 MDT 2010
The branch, master has been updated
via 3a033156c48d821d48fd18f12c3b0ac14bbddc93 (commit)
via cb8c779bb5d9862abbe08919aa181a1a1b2bef18 (commit)
from e6e16fcd5a45ebd3739a8160c8fb5f44494edb9e (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 3a033156c48d821d48fd18f12c3b0ac14bbddc93
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 cb8c779bb5d9862abbe08919aa181a1a1b2bef18
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 | 78 +++++++++++++++++++++++++++++++--------------
4 files changed, 60 insertions(+), 27 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 2394b44..f018554 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 4f8b759..371567a 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