mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
prepare next advisory tick debug only when debug is enabled (#472)
Co-authored-by: hadif <hadif@checkpoint.com>
This commit is contained in:
parent
9db6bf3159
commit
5f55027d26
1 changed files with 30 additions and 18 deletions
|
@ -3214,6 +3214,8 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
|
||||||
&& lsquic_mh_count(&engine->conns_out))
|
&& lsquic_mh_count(&engine->conns_out))
|
||||||
{
|
{
|
||||||
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
||||||
|
if (LSQ_LOG_ENABLED(L))
|
||||||
|
{
|
||||||
conn = lsquic_mh_peek(&engine->conns_out);
|
conn = lsquic_mh_peek(&engine->conns_out);
|
||||||
engine->last_logged_conn = 0;
|
engine->last_logged_conn = 0;
|
||||||
LSQ_LOGC(L, "next advisory tick is now: went past deadline last time "
|
LSQ_LOGC(L, "next advisory tick is now: went past deadline last time "
|
||||||
|
@ -3221,6 +3223,7 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
|
||||||
lsquic_mh_count(&engine->conns_out),
|
lsquic_mh_count(&engine->conns_out),
|
||||||
lsquic_mh_count(&engine->conns_out) != 1, "s",
|
lsquic_mh_count(&engine->conns_out) != 1, "s",
|
||||||
CID_BITS(lsquic_conn_log_cid(conn)));
|
CID_BITS(lsquic_conn_log_cid(conn)));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#if LSQUIC_CONN_STATS
|
#if LSQUIC_CONN_STATS
|
||||||
conn = lsquic_mh_peek(&engine->conns_out);
|
conn = lsquic_mh_peek(&engine->conns_out);
|
||||||
|
@ -3234,8 +3237,11 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
|
||||||
&& engine->pr_queue && lsquic_prq_have_pending(engine->pr_queue))
|
&& engine->pr_queue && lsquic_prq_have_pending(engine->pr_queue))
|
||||||
{
|
{
|
||||||
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
||||||
|
if (LSQ_LOG_ENABLED(L))
|
||||||
|
{
|
||||||
engine->last_logged_conn = 0;
|
engine->last_logged_conn = 0;
|
||||||
LSQ_LOG(L, "next advisory tick is now: have pending PRQ elements");
|
LSQ_LOG(L, "next advisory tick is now: have pending PRQ elements");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
*diff = 0;
|
*diff = 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -3244,6 +3250,8 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
|
||||||
if (lsquic_mh_count(&engine->conns_tickable))
|
if (lsquic_mh_count(&engine->conns_tickable))
|
||||||
{
|
{
|
||||||
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
||||||
|
if (LSQ_LOG_ENABLED(L))
|
||||||
|
{
|
||||||
conn = lsquic_mh_peek(&engine->conns_tickable);
|
conn = lsquic_mh_peek(&engine->conns_tickable);
|
||||||
engine->last_logged_conn = 0;
|
engine->last_logged_conn = 0;
|
||||||
LSQ_LOGC(L, "next advisory tick is now: have %u tickable "
|
LSQ_LOGC(L, "next advisory tick is now: have %u tickable "
|
||||||
|
@ -3251,6 +3259,7 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
|
||||||
lsquic_mh_count(&engine->conns_tickable),
|
lsquic_mh_count(&engine->conns_tickable),
|
||||||
lsquic_mh_count(&engine->conns_tickable) != 1, "s",
|
lsquic_mh_count(&engine->conns_tickable) != 1, "s",
|
||||||
CID_BITS(lsquic_conn_log_cid(conn)));
|
CID_BITS(lsquic_conn_log_cid(conn)));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#if LSQUIC_CONN_STATS
|
#if LSQUIC_CONN_STATS
|
||||||
conn = lsquic_mh_peek(&engine->conns_tickable);
|
conn = lsquic_mh_peek(&engine->conns_tickable);
|
||||||
|
@ -3286,28 +3295,31 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
|
||||||
now = lsquic_time_now();
|
now = lsquic_time_now();
|
||||||
*diff = (int) ((int64_t) next_time - (int64_t) now);
|
*diff = (int) ((int64_t) next_time - (int64_t) now);
|
||||||
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
#if LSQUIC_DEBUG_NEXT_ADV_TICK
|
||||||
if (next_attq)
|
if (LSQ_LOG_ENABLED(L))
|
||||||
{
|
{
|
||||||
/* Deduplicate consecutive log messages about the same reason for the
|
if (next_attq)
|
||||||
* same connection.
|
|
||||||
* If diff is always zero or diff reset to a higher value, event is
|
|
||||||
* still logged.
|
|
||||||
*/
|
|
||||||
if (!((unsigned) next_attq->ae_why == engine->last_logged_ae_why
|
|
||||||
&& (uintptr_t) next_attq->ae_conn
|
|
||||||
== engine->last_logged_conn
|
|
||||||
&& *diff < engine->last_tick_diff))
|
|
||||||
{
|
{
|
||||||
engine->last_logged_conn = (uintptr_t) next_attq->ae_conn;
|
/* Deduplicate consecutive log messages about the same reason for the
|
||||||
engine->last_logged_ae_why = (unsigned) next_attq->ae_why;
|
* same connection.
|
||||||
engine->last_tick_diff = *diff;
|
* If diff is always zero or diff reset to a higher value, event is
|
||||||
LSQ_LOGC(L, "next advisory tick is %d usec away: conn %"CID_FMT
|
* still logged.
|
||||||
": %s", *diff, CID_BITS(lsquic_conn_log_cid(next_attq->ae_conn)),
|
*/
|
||||||
lsquic_attq_why2str(next_attq->ae_why));
|
if (!((unsigned) next_attq->ae_why == engine->last_logged_ae_why
|
||||||
|
&& (uintptr_t) next_attq->ae_conn
|
||||||
|
== engine->last_logged_conn
|
||||||
|
&& *diff < engine->last_tick_diff))
|
||||||
|
{
|
||||||
|
engine->last_logged_conn = (uintptr_t) next_attq->ae_conn;
|
||||||
|
engine->last_logged_ae_why = (unsigned) next_attq->ae_why;
|
||||||
|
engine->last_tick_diff = *diff;
|
||||||
|
LSQ_LOGC(L, "next advisory tick is %d usec away: conn %"CID_FMT
|
||||||
|
": %s", *diff, CID_BITS(lsquic_conn_log_cid(next_attq->ae_conn)),
|
||||||
|
lsquic_attq_why2str(next_attq->ae_why));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
LSQ_LOG(L, "next advisory tick is %d usec away: resume sending", *diff);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
LSQ_LOG(L, "next advisory tick is %d usec away: resume sending", *diff);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LSQUIC_CONN_STATS
|
#if LSQUIC_CONN_STATS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue