Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanel committed May 8, 2024
1 parent 0f7412d commit c1f8acb
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions ratemon/runtime/c/libratemon_interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,22 @@ void timer_callback(const boost::system::error_code &error) {
// time. If there are waiting flows, one will be activated. Flows are paused
// and activated in round-robin order. Each flow is allowed to be active for
// epoch_us microseconds.
RM_PRINTF("IN TIMER_CALLBACK\n");
RM_PRINTF("INFO: in timer_callback\n");

if (error) {
RM_PRINTF("ERROR: timer_callback error: %s\n", error.message().c_str());
return;
}

if (!run) {
RM_PRINTF("INFO: exiting...\n");
RM_PRINTF("INFO: exiting\n");
return;
}

// If setup has not been performed yet, then we cannot perform scheduling.
if (!setup) {
// RM_PRINTF("WARNING setup not completed, skipping scheduling\n");
if (timer.expires_from_now(one_sec)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
RM_PRINTF("INFO: not set up (flag)\n");
Expand All @@ -118,7 +117,7 @@ void timer_callback(const boost::system::error_code &error) {
"flow_to_rwnd_fd=%d\n",
max_active_flows, epoch_us, num_to_schedule, flow_to_rwnd_fd);
if (timer.expires_from_now(one_sec)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
RM_PRINTF("INFO: not set up (params)\n");
Expand All @@ -130,7 +129,7 @@ void timer_callback(const boost::system::error_code &error) {

if (active_fds_queue.empty() && paused_fds_queue.empty()) {
if (timer.expires_from_now(one_sec)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
lock_scheduler.unlock();
Expand All @@ -143,7 +142,7 @@ void timer_callback(const boost::system::error_code &error) {
if (now < active_fds_queue.front().second) {
// The next flow should not be scheduled yet.
if (timer.expires_from_now(active_fds_queue.front().second - now)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
lock_scheduler.unlock();
Expand Down Expand Up @@ -234,7 +233,7 @@ void timer_callback(const boost::system::error_code &error) {
if (active_fds_queue.empty()) {
// If we cleaned up all flows, then revert to slow check mode.
if (timer.expires_from_now(one_sec)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
lock_scheduler.unlock();
Expand All @@ -243,7 +242,7 @@ void timer_callback(const boost::system::error_code &error) {
}
// Trigger scheduling for the next flow.
if (timer.expires_from_now(active_fds_queue.front().second - now)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
lock_scheduler.unlock();
Expand All @@ -256,7 +255,7 @@ void thread_func() {
// managing the async timers that perform scheduling.
RM_PRINTF("INFO: scheduler thread started\n");
if (timer.expires_from_now(one_sec)) {
RM_PRINTF("ERROR: cancelled time when should not have!\n");
RM_PRINTF("ERROR: cancelled timer when should not have!\n");
}
timer.async_wait(&timer_callback);
RM_PRINTF("INFO: scheduler thread initial sleep\n");
Expand Down

0 comments on commit c1f8acb

Please sign in to comment.