const char *doclose;
struct http *http;
+ struct timespec t_open;
struct timespec t_req;
+ struct timespec t_resp;
struct timespec t_idle;
enum step step;
sp = SES_New(addr, l);
assert(sp != NULL); /* XXX handle */
+ (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
sp->fd = i;
sp->id = i;
SES_Delete(sp);
return;
}
+ (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
assert(sizeof sp == write(pipes[1], &sp, sizeof sp));
}
SES_Delete(sp);
return;
}
+ (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
if (http_RecvPrepAgain(sp->http))
vca_handover(sp, 0);
TAILQ_REMOVE(&bp->connlist, vc, list);
} else {
vc2 = TAILQ_FIRST(&vbe_head);
- if (vc2 != NULL)
+ if (vc2 != NULL) {
+ VSL_stats->backend_unused--;
TAILQ_REMOVE(&vbe_head, vc2, list);
+ }
}
AZ(pthread_mutex_unlock(&vbemtx));
if (vc == NULL)
if (vc->fd < 0) {
vc->backend = NULL;
TAILQ_INSERT_HEAD(&vbe_head, vc, list);
+ VSL_stats->backend_unused++;
vc = NULL;
} else {
vc->backend = bp;
vc->backend = NULL;
AZ(pthread_mutex_lock(&vbemtx));
TAILQ_INSERT_HEAD(&vbe_head, vc, list);
+ VSL_stats->backend_unused++;
AZ(pthread_mutex_unlock(&vbemtx));
}
DOT ]
*/
+static double
+cnt_dt(struct timespec *t1, struct timespec *t2)
+{
+ double dt;
+
+ dt = (t2->tv_sec - t1->tv_sec);
+ dt += (t2->tv_nsec - t1->tv_nsec) * 1e-9;
+ return (dt);
+}
+
static int
cnt_done(struct sess *sp)
{
+ double dh, dp, da;
+ struct timespec te;
assert(sp->obj == NULL);
assert(sp->vbc == NULL);
VCL_Rel(sp->vcl);
sp->vcl = NULL;
+ clock_gettime(CLOCK_REALTIME, &te);
+ dh = cnt_dt(&sp->t_open, &sp->t_req);
+ dp = cnt_dt(&sp->t_req, &sp->t_resp);
+ da = cnt_dt(&sp->t_resp, &te);
+ VSL(SLT_ReqServTime, sp->fd, "%u %ld.%09ld %.9f %.9f %.9f",
+ sp->xid, (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec,
+ dh, dp, da);
+
SES_Charge(sp);
vca_return_session(sp);
return (1);
char *b;
sp->t0 = time(NULL);
+ assert(sp->vcl == NULL);
sp->vcl = VCL_Get();
assert(sp->obj == NULL);
assert(vc != NULL);
sp->vbc = NULL;
+ clock_gettime(CLOCK_REALTIME, &sp->t_resp);
+
http_ClrHeader(sp->http);
http_CopyResp(sp->fd, sp->http, vc->http);
http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_PASS);
return;
}
+ clock_gettime(CLOCK_REALTIME, &sp->t_resp);
+
memset(fds, 0, sizeof fds);
fds[0].fd = vc->fd;
fds[0].events = POLLIN | POLLERR;
{
struct storage *st;
unsigned u = 0;
- double dt;
- struct timespec t_resp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- clock_gettime(CLOCK_REALTIME, &t_resp);
- dt = (t_resp.tv_sec - sp->t_req.tv_sec);
- dt += (t_resp.tv_nsec - sp->t_req.tv_nsec) * 1e-9;
- VSL(SLT_ReqServTime, sp->fd, "%ld.%09ld %.9f",
- (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, dt);
+ clock_gettime(CLOCK_REALTIME, &sp->t_resp);
if (sp->obj->response == 200 && sp->http->conds && res_do_conds(sp))
return;
struct acct *b = &sp->acct;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ assert(sp->obj == NULL);
+ assert(sp->vcl == NULL);
VSL_stats->n_sess--;
ses_relsrcaddr(sp);
VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju",