[SCM] CTDB repository - branch master updated - ctdb-1.0.114-120-g1bdfe0c
Ronnie Sahlberg
sahlberg at samba.org
Tue Jun 1 21:15:54 MDT 2010
The branch, master has been updated
via 1bdfe0cd3370a335b960ce1ef97eade93b0cd2fa (commit)
from 3f651eb8d71c7af0268460bc4b1476112140b290 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 1bdfe0cd3370a335b960ce1ef97eade93b0cd2fa
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 2 13:13:09 2010 +1000
Add a variable for start/current time to ctdb statistics
and print the time startistics was taken and for how long the statistics have been collected to the "ctdb statistics" output.
-----------------------------------------------------------------------
Summary of changes:
client/ctdb_client.c | 2 ++
include/ctdb_private.h | 2 ++
server/ctdb_control.c | 3 +++
tools/ctdb.c | 15 +++++++++++++++
4 files changed, 22 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 4997818..05e54a8 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -2925,6 +2925,8 @@ struct ctdb_context *ctdb_init(struct event_context *ev)
return NULL;
}
+ ctdb->statistics.statistics_start_time = timeval_current();
+
return ctdb;
}
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 2714845..16e5d60 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -333,6 +333,8 @@ struct ctdb_statistics {
double max_lockwait_latency;
double max_childwrite_latency;
uint32_t num_recoveries;
+ struct timeval statistics_start_time;
+ struct timeval statistics_current_time;
};
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 3cd79f1..0dbc0d9 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -108,6 +108,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
}
}
ctdb->statistics.recovering = (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE);
+ ctdb->statistics.statistics_current_time = timeval_current();
+
outdata->dptr = (uint8_t *)&ctdb->statistics;
outdata->dsize = sizeof(ctdb->statistics);
return 0;
@@ -128,6 +130,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
case CTDB_CONTROL_STATISTICS_RESET: {
CHECK_CONTROL_DATA_SIZE(0);
ZERO_STRUCT(ctdb->statistics);
+ ctdb->statistics.statistics_start_time = timeval_current();
return 0;
}
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 6990851..c99fbe5 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -162,6 +162,7 @@ static void show_statistics(struct ctdb_statistics *s)
int i;
const char *prefix=NULL;
int preflen=0;
+ int tmp, days, hours, minutes, seconds;
const struct {
const char *name;
uint32_t offset;
@@ -200,7 +201,19 @@ static void show_statistics(struct ctdb_statistics *s)
STATISTICS_FIELD(memory_used),
STATISTICS_FIELD(max_hop_count),
};
+ tmp = s->statistics_current_time.tv_sec - s->statistics_start_time.tv_sec;
+ seconds = tmp%60;
+ tmp /= 60;
+ minutes = tmp%60;
+ tmp /= 60;
+ hours = tmp%24;
+ tmp /= 24;
+ days = tmp;
+
printf("CTDB version %u\n", CTDB_VERSION);
+ printf("Current time of statistics : %s", ctime(&s->statistics_start_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;
@@ -223,6 +236,8 @@ static void show_statistics(struct ctdb_statistics *s)
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