CBDATA_CLASS_INIT(statefulhelper);
CBDATA_TYPE(helper_stateful_server);
+void
+HelperServerBase::initStats()
+{
+ stats.uses=0;
+ stats.replies=0;
+ stats.pending=0;
+ stats.releases=0;
+}
+
void
HelperServerBase::closePipesSafely()
{
srv = cbdataAlloc(helper_server);
srv->hIpc = hIpc;
srv->pid = pid;
+ srv->initStats();
srv->index = k;
srv->addr = hlp->addr;
srv->readPipe = new Comm::Connection;
srv->hIpc = hIpc;
srv->pid = pid;
srv->flags.reserved = 0;
- srv->stats.submits = 0;
- srv->stats.releases = 0;
+ srv->initStats();
srv->index = k;
srv->addr = hlp->addr;
srv->readPipe = new Comm::Connection;
storeAppendPrintf(sentry, "avg service time: %d msec\n",
hlp->stats.avg_svc_time);
storeAppendPrintf(sentry, "\n");
- storeAppendPrintf(sentry, "%7s\t%7s\t%7s\t%11s\t%s\t%7s\t%7s\t%7s\n",
+ storeAppendPrintf(sentry, "%7s\t%7s\t%7s\t%11s\t%11s\t%s\t%7s\t%7s\t%7s\n",
"#",
"FD",
"PID",
"# Requests",
+ "# Replies",
"Flags",
"Time",
"Offset",
for (dlink_node *link = hlp->servers.head; link; link = link->next) {
helper_server *srv = (helper_server*)link->data;
double tt = 0.001 * (srv->requests[0] ? tvSubMsec(srv->requests[0]->dispatch_time, current_time) : tvSubMsec(srv->dispatch_time, srv->answer_time));
- storeAppendPrintf(sentry, "%7d\t%7d\t%7d\t%11d\t%c%c%c%c\t%7.3f\t%7d\t%s\n",
+ storeAppendPrintf(sentry, "%7d\t%7d\t%7d\t%11" PRIu64 "\t%11" PRIu64 "%c%c%c%c\t%7.3f\t%7d\t%s\n",
srv->index + 1,
srv->readPipe->fd,
srv->pid,
srv->stats.uses,
+ srv->stats.replies,
srv->stats.pending ? 'B' : ' ',
srv->flags.writing ? 'W' : ' ',
srv->flags.closing ? 'C' : ' ',
storeAppendPrintf(sentry, "avg service time: %d msec\n",
hlp->stats.avg_svc_time);
storeAppendPrintf(sentry, "\n");
- storeAppendPrintf(sentry, "%7s\t%7s\t%7s\t%11s\t%6s\t%7s\t%7s\t%7s\n",
+ storeAppendPrintf(sentry, "%7s\t%7s\t%7s\t%11s\t%11s\t%6s\t%7s\t%7s\t%7s\n",
"#",
"FD",
"PID",
"# Requests",
+ "# Replies",
"Flags",
"Time",
"Offset",
for (dlink_node *link = hlp->servers.head; link; link = link->next) {
helper_stateful_server *srv = (helper_stateful_server *)link->data;
double tt = 0.001 * tvSubMsec(srv->dispatch_time, srv->flags.busy ? current_time : srv->answer_time);
- storeAppendPrintf(sentry, "%7d\t%7d\t%7d\t%11d\t%c%c%c%c%c\t%7.3f\t%7d\t%s\n",
+ storeAppendPrintf(sentry, "%7d\t%7d\t%7d\t%11" PRIu64 "\t%11" PRIu64 "\t%c%c%c%c%c\t%7.3f\t%7d\t%s\n",
srv->index + 1,
srv->readPipe->fd,
srv->pid,
srv->stats.uses,
+ srv->stats.replies,
srv->flags.busy ? 'B' : ' ',
srv->flags.closing ? 'C' : ' ',
srv->flags.reserved ? 'R' : ' ',
callback(cbdata, msg);
-- srv->stats.pending;
+ ++ srv->stats.replies;
++ hlp->stats.replies;
srv->roffset = 0;
helperStatefulRequestFree(r);
srv->request = NULL;
+
+ -- srv->stats.pending;
+ ++ srv->stats.replies;
+
++ hlp->stats.replies;
srv->answer_time = current_time;
hlp->stats.avg_svc_time =
assert(ptr);
*ptr = r;
- srv->stats.pending += 1;
r->dispatch_time = current_time;
if (srv->wqueue->isNull())
debugs(84, 5, "helperDispatch: Request sent to " << hlp->id_name << " #" << srv->index + 1 << ", " << strlen(r->buf) << " bytes");
++ srv->stats.uses;
+ ++ srv->stats.pending;
++ hlp->stats.requests;
}
(int) strlen(r->buf) << " bytes");
++ srv->stats.uses;
+ ++ srv->stats.pending;
++ hlp->stats.requests;
}