se_expect_no_data(qcs->sd);
/* TODO duplicated from mux_h2 */
- sess->t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept)) - sess->t_handshake;
+ sess->t_idle = ns_to_ms(tv_to_ns(&now) - sess->accept_ts) - sess->t_handshake;
if (!sc_new_from_endp(qcs->sd, sess, buf))
return NULL;
/* TODO duplicated from mux_h2 */
sess->accept_date = date;
- sess->tv_accept = now;
+ sess->accept_ts = tv_to_ns(&now);
sess->t_handshake = 0;
sess->t_idle = 0;
struct listener *listener; /* the listener by which the request arrived */
enum obj_type *origin; /* the connection / applet which initiated this session */
struct timeval accept_date; /* date of the session's accept() in user date */
- struct timeval tv_accept; /* date of the session's accept() in internal date (monotonic) */
+ ullong accept_ts; /* date of the session's accept() in internal date (monotonic) */
struct stkctr *stkctr; /* stick counters for tcp-connection */
struct vars vars; /* list of variables for the session scope. */
struct task *task; /* handshake timeout processing */
int logwait; /* log fields waiting to be collected : LW_* */
int level; /* log level to force + 1 if > 0, -1 = no log */
struct timeval accept_date; /* date of the stream's accept() in user date */
- struct timeval tv_accept; /* date of the stream's accept() in internal date (monotonic) */
+ ullong accept_ts; /* date of the session's accept() in internal date (monotonic) */
long t_handshake; /* handshake duration, -1 if never occurs */
long t_idle; /* idle duration, -1 if never occurs */
- struct timeval tv_request; /* date the request arrives, {0,0} if never occurs */
+ ullong request_ts; /* date when the request arrives in internal date */
long t_queue; /* delay before the stream gets out of the connect queue, -1 if never occurs */
long t_connect; /* delay before the connect() to the server succeeds, -1 if never occurs */
long t_data; /* delay before the first data byte from the server ... */
sc_shutdown(sc);
sc->flags |= SC_FL_ERROR;
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
/* we may need to know the position in the queue for logging */
pendconn_cond_unlink(s->pend_pos);
if (unlikely(!(s->flags & SF_ASSIGNED)))
sc->state = SC_ST_REQ;
else {
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
sc->state = SC_ST_ASS;
}
DBG_TRACE_STATE("dequeue connection request", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
/* ... and timeout expired */
s->conn_exp = TICK_ETERNITY;
s->flags &= ~SF_CONN_EXP;
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
/* we may need to know the position in the queue for logging */
pendconn_cond_unlink(s->pend_pos);
/* Connection remains in queue, check if we have to abort it */
if (back_may_abort_req(req, s)) {
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
/* we may need to know the position in the queue for logging */
pendconn_cond_unlink(s->pend_pos);
}
/* The server is assigned */
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
sc->state = SC_ST_ASS;
be_set_sess_last(s->be);
DBG_TRACE_STATE("connection request assigned to a server", STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
*/
BUG_ON(!sc_appctx(s->scb));
- if (tv_iszero(&s->logs.tv_request))
- s->logs.tv_request = now;
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ if (!s->logs.request_ts)
+ s->logs.request_ts = tv_to_ns(&now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
be_set_sess_last(s->be);
}
/* If there is data available for analysis, log the end of the idle time. */
if (c_data(req) && s->logs.t_idle == -1)
- s->logs.t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept)) - s->logs.t_handshake;
+ s->logs.t_idle = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts) - s->logs.t_handshake;
to_forward = pcli_parse_request(s, req, &errmsg, &next_pid);
if (to_forward > 0) {
sess_change_server(s, NULL);
}
- s->logs.t_close = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_close = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
stream_process_counters(s);
/* don't count other requests' data */
stream_update_time_stats(s);
s->logs.accept_date = date; /* user-visible date for logging */
- s->logs.tv_accept = now; /* corrected date for internal use */
+ s->logs.accept_ts = tv_to_ns(&now); /* corrected date for internal use */
s->logs.t_handshake = 0; /* There are no handshake in keep alive connection. */
s->logs.t_idle = -1;
- tv_zero(&s->logs.tv_request);
+ s->logs.request_ts = 0;
s->logs.t_queue = -1;
s->logs.t_connect = -1;
s->logs.t_data = -1;
finst = ((htxn->dir == SMP_OPT_DIR_REQ) ? SF_FINST_R : SF_FINST_H);
if (htxn->dir == SMP_OPT_DIR_REQ) {
/* let's log the request time */
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
if (s->sess->fe == s->be) /* report it if the request was intercepted by the frontend */
_HA_ATOMIC_INC(&s->sess->fe->fe_counters.intercepted_req);
}
goto fail;
/* Note: Only eval on the request */
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
req->analysers &= AN_REQ_FLT_END;
if (s->sess->fe == s->be) /* report it if the request was intercepted by the frontend */
if (rule->from == ACT_F_HTTP_REQ) {
/* let's log the request time */
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
req->analysers &= AN_REQ_FLT_END;
if (s->sess->fe == s->be) /* report it if the request was intercepted by the frontend */
if (!s->target && http_stats_check_uri(s, txn, px)) {
s->target = &http_stats_applet.obj_type;
if (unlikely(!sc_applet_create(s->scb, objt_applet(s->target)))) {
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_RESOURCE;
goto return_int_err;
if (s->be->cookie_name || sess->fe->capture_name)
http_manage_client_side_cookies(s, req);
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
stream_inc_http_err_ctr(s);
_HA_ATOMIC_INC(&sess->fe->fe_counters.denied_req);
if (s->flags & SF_BE_ASSIGNED)
req->analyse_exp = TICK_ETERNITY;
req->analysers &= ~an_bit;
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
/* OK let's go on with the BODY now */
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
return 1;
* It will not cause trouble to the logs because we can exclude
* the tarpitted connections by filtering on the 'PT' status flags.
*/
- s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
http_set_term_flags(s);
http_end:
/* The situation will not evolve, so let's give up on the analysis. */
- s->logs.tv_request = now; /* update the request timer to reflect full request */
+ s->logs.request_ts = tv_to_ns(&now); /* update the request timer to reflect full request */
req->analysers &= ~an_bit;
req->analyse_exp = TICK_ETERNITY;
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
end:
/* we want to have the response time before we start processing it */
- s->logs.t_data = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_data = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
/* end of job, return OK */
rep->analysers &= ~an_bit;
if (rule->flags & REDIRECT_FLAG_FROM_REQ) {
/* let's log the request time */
- s->logs.tv_request = now;
+ s->logs.request_ts = tv_to_ns(&now);
req->analysers &= AN_REQ_FLT_END;
if (s->sess->fe == s->be) /* report it if the request was intercepted by the frontend */
uniq_id = _HA_ATOMIC_FETCH_ADD(&global.req_count, 1);
/* prepare a valid log structure */
- tmp_strm_log.tv_accept = sess->tv_accept;
+ tmp_strm_log.accept_ts = sess->accept_ts;
tmp_strm_log.accept_date = sess->accept_date;
tmp_strm_log.t_handshake = sess->t_handshake;
tmp_strm_log.t_idle = (sess->t_idle >= 0 ? sess->t_idle : 0);
- tv_zero(&tmp_strm_log.tv_request);
+ tmp_strm_log.request_ts = 0;
tmp_strm_log.t_queue = -1;
tmp_strm_log.t_connect = -1;
tmp_strm_log.t_data = -1;
- tmp_strm_log.t_close = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept));
+ tmp_strm_log.t_close = ns_to_ms(tv_to_ns(&now) - sess->accept_ts);
tmp_strm_log.bytes_in = 0;
tmp_strm_log.bytes_out = 0;
tmp_strm_log.prx_queue_pos = 0;
}
t_request = -1;
- if (tv_isge(&logs->tv_request, &logs->tv_accept))
- t_request = ns_to_ms(tv_to_ns(&logs->tv_request) - tv_to_ns(&logs->tv_accept));
+ if ((llong)(logs->request_ts - logs->accept_ts) >= 0)
+ t_request = ns_to_ms(logs->request_ts - logs->accept_ts);
tmplog = dst;
}
if (h1s->sess->t_idle == -1)
- h1s->sess->t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&h1s->sess->tv_accept)) - h1s->sess->t_handshake;
+ h1s->sess->t_idle = ns_to_ms(tv_to_ns(&now) - h1s->sess->accept_ts) - h1s->sess->t_handshake;
/* Get the stream rxbuf */
buf = h1_get_buf(h1c, &h1s->rxbuf);
h1c = h1s->h1c;
sess->accept_date = date;
- sess->tv_accept = now;
+ sess->accept_ts = tv_to_ns(&now);
sess->t_handshake = 0;
sess->t_idle = -1;
* request) and the idle time, which is the delay since the previous
* request. We can set the value now, it will be copied by stream_new().
*/
- sess->t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept)) - sess->t_handshake;
+ sess->t_idle = ns_to_ms(tv_to_ns(&now) - sess->accept_ts) - sess->t_handshake;
if (!sc_new_from_endp(h2s->sd, sess, input))
goto out_close;
* right now.
*/
sess->accept_date = date;
- sess->tv_accept = now;
+ sess->accept_ts = tv_to_ns(&now);
sess->t_handshake = 0;
sess->t_idle = 0;
sess->fe = fe;
sess->origin = origin;
sess->accept_date = date; /* user-visible date for logging */
- sess->tv_accept = now; /* corrected date for internal use */
+ sess->accept_ts = tv_to_ns(&now); /* corrected date for internal use */
sess->stkctr = NULL;
if (pool_head_stk_ctr) {
sess->stkctr = pool_alloc(pool_head_stk_ctr);
{
struct session *sess = conn->owner;
- sess->t_handshake = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept));
+ sess->t_handshake = ns_to_ms(tv_to_ns(&now) - sess->accept_ts);
if (conn->flags & CO_FL_ERROR)
goto fail;
s->flags = 0;
s->logs.logwait = sess->fe->to_log;
s->logs.level = 0;
- tv_zero(&s->logs.tv_request);
+ s->logs.request_ts = 0;
s->logs.t_queue = -1;
s->logs.t_connect = -1;
s->logs.t_data = -1;
s->obj_type = OBJ_TYPE_STREAM;
s->logs.accept_date = sess->accept_date;
- s->logs.tv_accept = sess->tv_accept;
+ s->logs.accept_ts = sess->accept_ts;
s->logs.t_handshake = sess->t_handshake;
s->logs.t_idle = sess->t_idle;
/* First, centralize the timers information, and clear any irrelevant
* timeout.
*/
- s->logs.t_connect = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_connect = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
s->conn_exp = TICK_ETERNITY;
s->flags &= ~SF_CONN_EXP;
}
if (!(s->flags & SF_IGNORE)) {
- s->logs.t_close = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
+ s->logs.t_close = ns_to_ms(tv_to_ns(&now) - s->logs.accept_ts);
stream_process_counters(s);
if (t_connect < 0 || t_data < 0)
return;
- if (tv_isge(&s->logs.tv_request, &s->logs.tv_accept))
- t_request = ns_to_ms(tv_to_ns(&s->logs.tv_request) - tv_to_ns(&s->logs.tv_accept));
+ if ((llong)(s->logs.request_ts - s->logs.accept_ts) >= 0)
+ t_request = ns_to_ms(s->logs.request_ts - s->logs.accept_ts);
t_data -= t_connect;
t_connect -= t_queue;
chunk_appendf(&trash,
" ts=%02x epoch=%#x age=%s calls=%u rate=%u cpu=%llu lat=%llu",
curr_strm->task->state, curr_strm->stream_epoch,
- human_time(now.tv_sec - curr_strm->logs.tv_accept.tv_sec, 1),
+ human_time(now.tv_sec - ns_to_sec(curr_strm->logs.accept_ts), 1),
curr_strm->task->calls, read_freq_ctr(&curr_strm->call_rate),
(unsigned long long)curr_strm->cpu_time, (unsigned long long)curr_strm->lat_time);