se_expect_no_data(qcs->sd);
/* TODO duplicated from mux_h2 */
- sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
+ sess->t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept)) - sess->t_handshake;
if (!sc_new_from_endp(qcs->sd, sess, buf))
return NULL;
sc_shutdown(sc);
sc->flags |= SC_FL_ERROR;
- s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
/* 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 = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
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 = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
/* 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 = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
/* 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 = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
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);
if (tv_iszero(&s->logs.tv_request))
s->logs.tv_request = now;
- s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
be_set_sess_last(s->be);
}
check->duration = -1;
else if (!tv_iszero(&check->start)) {
/* set_server_check_status() may be called more than once */
- check->duration = tv_ms_elapsed(&check->start, &now);
+ check->duration = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&check->start));
tv_zero(&check->start);
}
/* 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 = tv_ms_elapsed(&s->logs.tv_accept, &now) - s->logs.t_handshake;
+ s->logs.t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept)) - 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 = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_close = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
stream_process_counters(s);
/* don't count other requests' data */
spoe_update_stat_time(struct timeval *tv, long *t)
{
if (*t == -1)
- *t = tv_ms_elapsed(tv, &now);
+ *t = ns_to_ms(tv_to_ns(&now) - tv_to_ns(tv));
else
- *t += tv_ms_elapsed(tv, &now);
+ *t += ns_to_ms(tv_to_ns(&now) - tv_to_ns(tv));
tv_zero(tv);
}
* 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 = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_queue = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
http_set_term_flags(s);
end:
/* we want to have the response time before we start processing it */
- s->logs.t_data = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_data = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
/* end of job, return OK */
rep->analysers &= ~an_bit;
tmp_strm_log.t_queue = -1;
tmp_strm_log.t_connect = -1;
tmp_strm_log.t_data = -1;
- tmp_strm_log.t_close = tv_ms_elapsed(&sess->tv_accept, &now);
+ tmp_strm_log.t_close = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept));
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 = tv_ms_elapsed(&logs->tv_accept, &logs->tv_request);
+ t_request = ns_to_ms(tv_to_ns(&logs->tv_request) - tv_to_ns(&logs->tv_accept));
tmplog = dst;
}
if (h1s->sess->t_idle == -1)
- h1s->sess->t_idle = tv_ms_elapsed(&h1s->sess->tv_accept, &now) - h1s->sess->t_handshake;
+ h1s->sess->t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&h1s->sess->tv_accept)) - h1s->sess->t_handshake;
/* Get the stream rxbuf */
buf = h1_get_buf(h1c, &h1s->rxbuf);
* 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 = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
+ sess->t_idle = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept)) - sess->t_handshake;
if (!sc_new_from_endp(h2s->sd, sess, input))
goto out_close;
{
struct session *sess = conn->owner;
- sess->t_handshake = tv_ms_elapsed(&sess->tv_accept, &now);
+ sess->t_handshake = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&sess->tv_accept));
if (conn->flags & CO_FL_ERROR)
goto fail;
/* First, centralize the timers information, and clear any irrelevant
* timeout.
*/
- s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_connect = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
s->conn_exp = TICK_ETERNITY;
s->flags &= ~SF_CONN_EXP;
}
if (!(s->flags & SF_IGNORE)) {
- s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);
+ s->logs.t_close = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&s->logs.tv_accept));
stream_process_counters(s);
return;
if (tv_isge(&s->logs.tv_request, &s->logs.tv_accept))
- t_request = tv_ms_elapsed(&s->logs.tv_accept, &s->logs.tv_request);
+ t_request = ns_to_ms(tv_to_ns(&s->logs.tv_request) - tv_to_ns(&s->logs.tv_accept));
t_data -= t_connect;
t_connect -= t_queue;