From b37ee220e9f529d70c331c44983bc38812a5b3ac Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 22 Mar 2015 20:36:33 +1100 Subject: [PATCH] Add psends to generator stats --- src/generator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/generator.c b/src/generator.c index 5513825b..75e51849 100644 --- a/src/generator.c +++ b/src/generator.c @@ -145,6 +145,7 @@ struct generator_data { pthread_cond_t psend_cond; stratum_msg_t *psends; + int psends_generated; mutex_t notify_lock; notify_instance_t *notify_instances; @@ -1429,6 +1430,7 @@ static void submit_share(gdata_t *gdata, json_t *val) /* Add the new message to the psend list */ mutex_lock(&gdata->psend_lock); + gdata->psends_generated++; DL_APPEND(gdata->psends, msg); pthread_cond_signal(&gdata->psend_cond); mutex_unlock(&gdata->psend_lock); @@ -2369,6 +2371,7 @@ static void send_stats(gdata_t *gdata, const int sockd) json_t *val = json_object(), *subval; int total_objects, objects, generated; proxy_instance_t *proxy; + stratum_msg_t *msg; int64_t memsize; mutex_lock(&gdata->lock); @@ -2414,6 +2417,15 @@ static void send_stats(gdata_t *gdata, const int sockd) JSON_CPACK(subval, "{si,si,si}", "count", objects, "memory", memsize, "generated", generated); json_set_object(val, "shares", subval); + mutex_lock(&gdata->psend_lock); + DL_COUNT(gdata->psends, msg, objects); + generated = gdata->psends_generated; + mutex_unlock(&gdata->psend_lock); + + memsize = sizeof(stratum_msg_t) * objects; + JSON_CPACK(subval, "{si,si,si}", "count", objects, "memory", memsize, "generated", generated); + json_set_object(val, "psends", subval); + send_api_response(val, sockd); }