Skip to content

Commit f5079c4

Browse files
committed
improve log messages
1 parent 7c5e89b commit f5079c4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/scheduler.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,21 +363,23 @@ void Scheduler::next() { // NOLINT
363363
}
364364
} else {
365365
auto t_next = event_queue_.next_tag();
366-
log_.debug() << "try to advance logical time to tag " << t_next;
367366

368367
// synchronize with physical time if not in fast forward mode
369368
if (!environment_->fast_fwd_execution()) {
369+
log_.debug() << "acquire tag " << t_next << " from physical time barrier";
370370
bool result = PhysicalTimeBarrier::acquire_tag(
371371
t_next, lock, this, [&t_next, this]() { return t_next != event_queue_.next_tag(); });
372372
// If acquire tag returns false, then a new event was inserted into the queue and we need to start over
373373
if (!result) {
374+
log_.debug() << "abort waiting and restart as the event queue was modified";
374375
continue;
375376
}
376377
}
377378

378379
// Wait until all input actions mark the tag as safe to process.
379380
bool result{true};
380381
for (auto* action : environment_->input_actions_) {
382+
log_.debug() << "acquire tag " << t_next << " from input action " << action->fqn();
381383
bool inner_result =
382384
action->acquire_tag(t_next, lock, [&t_next, this]() { return t_next != event_queue_.next_tag(); });
383385
// If the wait was aborted or if the next tag changed in the meantime,
@@ -389,6 +391,7 @@ void Scheduler::next() { // NOLINT
389391
}
390392
// If acquire tag returns false, then a new event was inserted into the queue and we need to start over
391393
if (!result) {
394+
log_.debug() << "abort waiting and restart as the event queue was modified";
392395
continue;
393396
}
394397

@@ -468,18 +471,20 @@ auto Scheduler::schedule_async_at(BaseAction* action, const Tag& tag) -> bool {
468471
}
469472

470473
auto Scheduler::schedule_empty_async_at(const Tag& tag) -> bool {
471-
log_.debug() << "Schedule empty event at tag " << tag;
472474
{
473475
std::lock_guard<std::mutex> lock_guard(scheduling_mutex_);
474476
if (tag <= logical_time_) {
475477
// If we try to insert an empty event at the current logical time, then we
476478
// succeeded because there must be an event at this tag that is currently
477479
// processed.
478-
return tag == logical_time_;
480+
bool result{tag == logical_time_};
481+
log_.debug() << "try to schedule empty event at tag " << tag << (result ? " -> succeeded" : " -> failed");
482+
return result;
479483
}
480484
event_queue_.insert_event_at(tag);
481485
}
482486
notify();
487+
log_.debug() << "try to schedule empty event at tag " << tag << " -> succeeded";
483488
return true;
484489
}
485490

0 commit comments

Comments
 (0)