Commit 2aad39d0 authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Add new log component for streaming-related events

parent b93be04a
......@@ -613,3 +613,20 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
"TERMINATE ; ID =" << thisptr->id() \
<< "; REASON =" << deep_to_string(rsn).c_str() \
<< "; NODE =" << thisptr->node())
// -- macros for logging streaming-related events ------------------------------
/// The log component for logging streaming-related events that are crucial for
/// understanding handshaking, credit decisions, etc.
#define CAF_LOG_STREAM_COMPONENT "caf_stream"
#if CAF_LOG_LEVEL >= CAF_LOG_LEVEL_DEBUG
#define CAF_STREAM_LOG_DEBUG(output) \
CAF_LOG_IMPL(CAF_LOG_STREAM_COMPONENT, CAF_LOG_LEVEL_DEBUG, output)
#define CAF_STREAM_LOG_DEBUG_IF(condition, output) \
if (condition) \
CAF_LOG_IMPL(CAF_LOG_STREAM_COMPONENT, CAF_LOG_LEVEL_DEBUG, output)
#else
#define CAF_STREAM_LOG_DEBUG(unused) CAF_VOID_STMT
#define CAF_STREAM_LOG_DEBUG_IF(unused1, unused2) CAF_VOID_STMT
#endif
......@@ -88,10 +88,18 @@ void inbound_path::handle(downstream_msg::batch& x) {
auto batch_size = x.xs_size;
last_batch_id = x.id;
auto t0 = clk.now();
CAF_STREAM_LOG_DEBUG("handle batch of size"
<< batch_size << "on slot" << slots.receiver << "with"
<< assigned_credit << "assigned credit");
if (assigned_credit <= batch_size) {
assigned_credit = 0;
// Do not log a message when "running out of credit" for the first batch
// that can easily consume the initial credit in one shot.
CAF_STREAM_LOG_DEBUG_IF(next_credit_decision.time_since_epoch().count() > 0,
"source at slot" << slots.receiver
<< "ran out of credit with approx."
<< (next_credit_decision - t0)
<< "until next cycle");
} else {
assigned_credit -= batch_size;
CAF_ASSERT(assigned_credit >= 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment