Skip to content

Commit

Permalink
i#6938 sched migrate: Count direct switches as migrations (#6969)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
derekbruening authored Sep 10, 2024
1 parent 02c1430 commit ddcae43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clients/drcachesim/scheduler/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2949,6 +2949,11 @@ scheduler_tmpl_t<RecordType, ReaderType>::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)) {
Expand All @@ -2961,6 +2966,11 @@ scheduler_tmpl_t<RecordType, ReaderType>::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 {
Expand Down

0 comments on commit ddcae43

Please sign in to comment.