From 685232670aa717850f304a5299781520405a419d Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 26 Mar 2008 16:13:14 +0000 Subject: [PATCH] added uptime statistics to statusall --- src/charon/plugins/stroke/stroke_list.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/charon/plugins/stroke/stroke_list.c b/src/charon/plugins/stroke/stroke_list.c index 5ce02d93f..38c2bf1f0 100644 --- a/src/charon/plugins/stroke/stroke_list.c +++ b/src/charon/plugins/stroke/stroke_list.c @@ -36,6 +36,11 @@ struct private_stroke_list_t { * public functions */ stroke_list_t public; + + /** + * timestamp of daemon start + */ + time_t uptime; }; /** @@ -178,12 +183,15 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo child_cfg_t *child_cfg; ike_sa_t *ike_sa; char *name = NULL; + time_t uptime; name = msg->status.name; if (all) { + uptime = time(NULL) - this->uptime; fprintf(out, "Performance:\n"); + fprintf(out, " uptime: %V, since %T\n", &uptime, &this->uptime); fprintf(out, " worker threads: %d idle of %d,", charon->processor->get_idle_threads(charon->processor), charon->processor->get_total_threads(charon->processor)); @@ -517,6 +525,8 @@ stroke_list_t *stroke_list_create() this->public.status = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out,bool))status; this->public.destroy = (void(*)(stroke_list_t*))destroy; + this->uptime = time(NULL); + return &this->public; }