Commit 91bb1902 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: monitor.interval in whole second precision

parent 785079bf
......@@ -118,6 +118,7 @@ CONF_Add(const char *lval, const char *rval)
confUnsigned("maxdata.scale", maxdata_scale);
confUnsigned("nworkers", nworkers);
confUnsigned("restarts", restarts);
confUnsigned("monitor.interval", monitor_interval);
if (strcmp(lval, "syslog.facility") == 0) {
if ((ret = conf_getFacility(rval)) < 0)
......@@ -129,18 +130,6 @@ CONF_Add(const char *lval, const char *rval)
return(0);
}
if (strcmp(lval, "monitor.interval") == 0) {
char *p;
errno = 0;
double d = strtod(rval, &p);
if (errno)
return(errno);
if (strlen(p) != 0 || d < 0 || !isfinite(d))
return(EINVAL);
config.monitor_interval = d;
return(0);
}
if (strcmp(lval, "user") == 0) {
struct passwd *pw;
......@@ -289,14 +278,14 @@ CONF_Dump(void)
strcmp(config.log_file,"-") == 0 ? "stdout" : config.log_file);
confdump("varnish.bindump = %s", config.varnish_bindump);
confdump("syslog.facility = %s", config.syslog_facility_name);
confdump("monitor.interval = %.1f", config.monitor_interval);
confdump("monitor.interval = %u", config.monitor_interval);
confdump("monitor.workers = %s", config.monitor_workers ? "true" : "false");
confdump("processor.log = %s", config.processor_log);
confdump("maxopen.scale = %d", config.maxopen_scale);
confdump("maxdata.scale = %d", config.maxdata_scale);
confdump("maxopen.scale = %u", config.maxopen_scale);
confdump("maxdata.scale = %u", config.maxdata_scale);
confdump("mq.uri = %s", config.mq_uri);
confdump("mq.qname = %s", config.mq_qname);
confdump("nworkers = %d", config.nworkers);
confdump("restarts = %d", config.restarts);
confdump("nworkers = %u", config.nworkers);
confdump("restarts = %u", config.restarts);
confdump("user = %s", config.user_name);
}
......@@ -70,12 +70,11 @@ void
*MON_StatusThread(void *arg)
{
struct timespec t;
double *interval = (double *) arg;
unsigned *interval = (unsigned *) arg;
t.tv_sec = (time_t) *interval;
t.tv_nsec = (long)(t.tv_sec - *interval) * 10e9;
LOG_Log(LOG_INFO, "Monitor thread running every %.2f secs",
t.tv_sec + ((float) t.tv_nsec * 10e-9));
t.tv_nsec = 0;
LOG_Log(LOG_INFO, "Monitor thread running every %u secs", t.tv_sec);
run = 1;
pthread_cleanup_push(monitor_cleanup, arg);
......
......@@ -152,7 +152,7 @@ struct config {
char varnish_bindump[BUFSIZ];
int syslog_facility;
char syslog_facility_name[BUFSIZ];
double monitor_interval;
unsigned monitor_interval;
bool monitor_workers;
char processor_log[BUFSIZ];
unsigned maxopen_scale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment