prepare next advisory tick debug only when debug is enabled (#472)

Co-authored-by: hadif <hadif@checkpoint.com>
This commit is contained in:
Hadi Frohar 2023-08-10 00:56:33 +03:00 committed by GitHub
parent 836b0deadb
commit c7dfaca894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3368,6 +3368,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 "
@ -3375,6 +3377,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);
@ -3388,8 +3391,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;
@ -3398,6 +3404,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 "
@ -3405,6 +3413,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);
@ -3440,6 +3449,8 @@ 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 (LSQ_LOG_ENABLED(L))
{
if (next_attq) if (next_attq)
{ {
/* Deduplicate consecutive log messages about the same reason for the /* Deduplicate consecutive log messages about the same reason for the
@ -3462,6 +3473,7 @@ lsquic_engine_earliest_adv_tick (lsquic_engine_t *engine, int *diff)
} }
else else
LSQ_LOG(L, "next advisory tick is %d usec away: resume sending", *diff); LSQ_LOG(L, "next advisory tick is %d usec away: resume sending", *diff);
}
#endif #endif
#if LSQUIC_CONN_STATS #if LSQUIC_CONN_STATS