Skip to content

Commit

Permalink
inc-proc-eng: Properly log recompute reason.
Browse files Browse the repository at this point in the history
The 'reason' was computed only when logging at level DBG.  However, if a
node takes more than 'engine_compute_log_timeout_msec' to recompute, the
log is generated at level INFO, resulting in:

  inc_proc_eng|INFO|node: northd, recompute ((null))

We now unconditionally compute 'reason'.  In theory it's a bit
inefficient but given that the number of I-P nodes is bound and usually
relatively low, there's no real performance hit while the code remains
readable.

Fixes: e1041d9 ("inc-proc-eng: use VLOG_INFO_RL for recompute time over 500ms")
Signed-off-by: Dumitru Ceara <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Mark Michelson <[email protected]>
dceara authored and putnopvut committed Mar 29, 2022
1 parent 31e9f6d commit a24ef9d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/inc-proc-eng.c
Original file line number Diff line number Diff line change
@@ -354,14 +354,11 @@ engine_recompute(struct engine_node *node, bool allowed,
const char *reason_fmt, ...)
{
char *reason = NULL;
va_list reason_args;

if (VLOG_IS_DBG_ENABLED()) {
va_list reason_args;

va_start(reason_args, reason_fmt);
reason = xvasprintf(reason_fmt, reason_args);
va_end(reason_args);
}
va_start(reason_args, reason_fmt);
reason = xvasprintf(reason_fmt, reason_args);
va_end(reason_args);

if (!allowed) {
VLOG_DBG("node: %s, recompute (%s) aborted", node->name, reason);

0 comments on commit a24ef9d

Please sign in to comment.