Skip to content

Commit

Permalink
i#6938 migrate: Fix observed_migrations assert in schedule_stats
Browse files Browse the repository at this point in the history
Fixes an assert on the new observed_migrations stat added to
schedule_stats in PR #7057.  These observed_migrations are counted on
the destination core, while the scheduler reports migrations away from
a source core: so they can differ, causing the assert to fire.  Fixed
by moving it to only check the aggregated stats across all cores.

Tested on the internal trace where the assert fired before.

Issue: #6938
  • Loading branch information
derekbruening committed Oct 28, 2024
1 parent d689927 commit 9dc7032
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions clients/drcachesim/tools/schedule_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,13 @@ schedule_stats_t::aggregate_results(counters_t &total)
assert(shard.second->counters.direct_switches ==
shard.second->stream->get_schedule_statistic(
memtrace_stream_t::SCHED_STAT_DIRECT_SWITCH_SUCCESSES));
// If the scheduler is counting migrations, it may see more due to inputs
// not yet executed moving among runqueues.
#ifndef NDEBUG
double sched_migrations = shard.second->stream->get_schedule_statistic(
memtrace_stream_t::SCHED_STAT_MIGRATIONS);
#endif
assert(sched_migrations == 0. ||
sched_migrations >= shard.second->counters.observed_migrations);
}
// Our observed_migrations are counted on the destination core, while
// the scheduler reports migrations away from a source core: so we only
// check the aggregate. For non-dynamic schedules the scheduler-reported
// will be 0; otherwise, the scheduler may see more migrations due to inputs
// not yet executed moving among runqueues.
assert(total.migrations == 0. || total.migrations >= total.observed_migrations);
}

bool
Expand Down

0 comments on commit 9dc7032

Please sign in to comment.