From 79f37cfe468b5c7b4bd3903ae6cb371997590e15 Mon Sep 17 00:00:00 2001 From: Derek Bruening Date: Mon, 9 Sep 2024 14:48:46 -0400 Subject: [PATCH] i#6938 sched migrate: Count direct switches as migrations Direct thread switches were not being counted as migrations in the original migration stats in PR #6950: we address that here. A test with multiple outputs will be added later as part of the move to separate runqueues, which is where this bug was discovered. Issue: #6938 --- clients/drcachesim/scheduler/scheduler.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clients/drcachesim/scheduler/scheduler.cpp b/clients/drcachesim/scheduler/scheduler.cpp index f5107f2e2f9..7caadeb4371 100644 --- a/clients/drcachesim/scheduler/scheduler.cpp +++ b/clients/drcachesim/scheduler/scheduler.cpp @@ -2953,6 +2953,11 @@ scheduler_tmpl_t::pick_next_input(output_ordinal_t outpu target->blocked_time = 0; target->unscheduled = false; } + if (target->prev_output != INVALID_OUTPUT_ORDINAL && + target->prev_output != output) { + ++outputs_[output] + .stats[memtrace_stream_t::SCHED_STAT_MIGRATIONS]; + } ++outputs_[output].stats [memtrace_stream_t::SCHED_STAT_DIRECT_SWITCH_SUCCESSES]; } else if (unscheduled_priority_.find(target)) { @@ -2965,6 +2970,11 @@ scheduler_tmpl_t::pick_next_input(output_ordinal_t outpu "@%" PRIu64 "\n", output, prev_index, target->index, inputs_[prev_index].reader->get_last_timestamp()); + if (target->prev_output != INVALID_OUTPUT_ORDINAL && + target->prev_output != output) { + ++outputs_[output] + .stats[memtrace_stream_t::SCHED_STAT_MIGRATIONS]; + } ++outputs_[output].stats [memtrace_stream_t::SCHED_STAT_DIRECT_SWITCH_SUCCESSES]; } else {