Commit 320175f3 authored by Geoff Simmons's avatar Geoff Simmons

monitor thread emits more stats about worker threads

parent 25c05ad0
...@@ -42,10 +42,10 @@ static int run; ...@@ -42,10 +42,10 @@ static int run;
static pthread_mutex_t mutex; static pthread_mutex_t mutex;
static unsigned occ; static unsigned occ;
static unsigned sent; /* Sent successfully to MQ */ static unsigned long sent; /* Sent successfully to MQ */
static unsigned failed; /* MQ send fails */ static unsigned long failed; /* MQ send fails */
static unsigned reconnects; /* Reconnects to MQ */ static unsigned long reconnects; /* Reconnects to MQ */
static unsigned restarts; /* Worker thread restarts */ static unsigned long restarts; /* Worker thread restarts */
static unsigned occ_hi; /* Occupancy high water mark */ static unsigned occ_hi; /* Occupancy high water mark */
static unsigned occ_hi_this; /* Occupancy high water mark static unsigned occ_hi_this; /* Occupancy high water mark
this reporting interval*/ this reporting interval*/
...@@ -53,7 +53,12 @@ static unsigned occ_hi_this; /* Occupancy high water mark ...@@ -53,7 +53,12 @@ static unsigned occ_hi_this; /* Occupancy high water mark
static void static void
log_output(void) log_output(void)
{ {
int wrk_running = WRK_Running(); static int wrk_running_hi = 0;
int wrk_active = WRK_Running();
int wrk_running = wrk_active - spmcq_datawaiter;
if (wrk_running > wrk_running_hi)
wrk_running_hi = wrk_running;
LOG_Log(LOG_INFO, "Data table: len=%u occ=%u occ_hi=%u occ_hi_this=%u " LOG_Log(LOG_INFO, "Data table: len=%u occ=%u occ_hi=%u occ_hi_this=%u "
"global_free=%u", "global_free=%u",
...@@ -64,13 +69,15 @@ log_output(void) ...@@ -64,13 +69,15 @@ log_output(void)
RDR_Stats(); RDR_Stats();
#endif #endif
if (wrk_running < config.nworkers) if (wrk_active < config.nworkers)
LOG_Log(LOG_WARNING, "%d of %d workers running", wrk_running, LOG_Log(LOG_WARNING, "%d of %d workers active", wrk_running,
config.nworkers); config.nworkers);
/* XXX: seen, bytes sent */ /* XXX: seen, bytes sent */
LOG_Log(LOG_INFO, "Workers: running=%d sent=%lu failed=%u reconnects=%u " LOG_Log(LOG_INFO, "Workers: active=%d running=%d waiting=%d running_hi=%d "
"restarts=%u abandoned=%u", "exited=%d abandoned=%u reconnects=%lu restarts=%lu sent=%lu "
wrk_running, sent, failed, reconnects, restarts, failed, abandoned); "failed=%lu",
wrk_active, wrk_running, spmcq_datawaiter, wrk_running_hi,
WRK_Exited(), abandoned, reconnects, restarts, sent, failed);
/* locking would be overkill */ /* locking would be overkill */
occ_hi_this = 0; occ_hi_this = 0;
......
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