added uptime statistics to statusall
This commit is contained in:
@@ -36,6 +36,11 @@ struct private_stroke_list_t {
|
|||||||
* public functions
|
* public functions
|
||||||
*/
|
*/
|
||||||
stroke_list_t public;
|
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;
|
child_cfg_t *child_cfg;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
time_t uptime;
|
||||||
|
|
||||||
name = msg->status.name;
|
name = msg->status.name;
|
||||||
|
|
||||||
if (all)
|
if (all)
|
||||||
{
|
{
|
||||||
|
uptime = time(NULL) - this->uptime;
|
||||||
fprintf(out, "Performance:\n");
|
fprintf(out, "Performance:\n");
|
||||||
|
fprintf(out, " uptime: %V, since %T\n", &uptime, &this->uptime);
|
||||||
fprintf(out, " worker threads: %d idle of %d,",
|
fprintf(out, " worker threads: %d idle of %d,",
|
||||||
charon->processor->get_idle_threads(charon->processor),
|
charon->processor->get_idle_threads(charon->processor),
|
||||||
charon->processor->get_total_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.status = (void(*)(stroke_list_t*, stroke_msg_t *msg, FILE *out,bool))status;
|
||||||
this->public.destroy = (void(*)(stroke_list_t*))destroy;
|
this->public.destroy = (void(*)(stroke_list_t*))destroy;
|
||||||
|
|
||||||
|
this->uptime = time(NULL);
|
||||||
|
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user