Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#6938 sched migrate: Fix direct switch blocked_start_time #6970

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clients/drcachesim/common/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ droption_t<double> op_sched_block_scale(
// long idle times with local analyzers; it may need to be increased with more
// heavyweight analyzers/simulators.
droption_t<uint64_t> op_sched_block_max_us(DROPTION_SCOPE_ALL, "sched_block_max_us",
2500000,
250000,
"Maximum blocked input time, in microseconds",
"The maximum blocked time, after scaling with "
"-sched_block_scale.");
Expand Down
2 changes: 2 additions & 0 deletions clients/drcachesim/scheduler/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3174,6 +3174,7 @@ scheduler_tmpl_t<RecordType, ReaderType>::process_marker(input_info_t &input,
input.unscheduled = true;
if (input.syscall_timeout_arg > 0) {
input.blocked_time = scale_blocked_time(input.syscall_timeout_arg);
input.blocked_start_time = get_output_time(output);
VPRINT(this, 3, "input %d unscheduled for %" PRIu64 " @%" PRIu64 "\n",
input.index, input.blocked_time, input.reader->get_last_timestamp());
} else {
Expand Down Expand Up @@ -3201,6 +3202,7 @@ scheduler_tmpl_t<RecordType, ReaderType>::process_marker(input_info_t &input,
input.unscheduled = true;
if (input.syscall_timeout_arg > 0) {
input.blocked_time = scale_blocked_time(input.syscall_timeout_arg);
input.blocked_start_time = get_output_time(output);
VPRINT(this, 3, "input %d unscheduled for %" PRIu64 " @%" PRIu64 "\n",
input.index, input.blocked_time, input.reader->get_last_timestamp());
} else {
Expand Down
2 changes: 1 addition & 1 deletion clients/drcachesim/scheduler/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ template <typename RecordType, typename ReaderType> class scheduler_tmpl_t {
* #TRACE_MARKER_TYPE_SYSCALL_UNSCHEDULE), after this amount of time those
* inputs are all re-scheduled.
*/
uint64_t block_time_max = 2500000;
uint64_t block_time_max = 250000;
// XXX: Should we share the file-to-reader code currently in the scheduler
// with the analyzer and only then need reader interfaces and not pass paths
// to the scheduler?
Expand Down
11 changes: 6 additions & 5 deletions clients/drcachesim/tests/scheduler_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4246,7 +4246,7 @@ test_direct_switch()
// has significant blocked time left. But then after B is scheduled and finishes,
// we still have to wait for C's block time so we see idle underscores:
static const char *const CORE0_SCHED_STRING =
"...AA..........CC.......A....BBBB.__________C....";
"...AA..........CC.......A....BBBB._______________C....";
std::vector<scheduler_t::input_workload_t> sched_inputs;
sched_inputs.emplace_back(std::move(readers));
scheduler_t::scheduler_options_t sched_ops(scheduler_t::MAP_TO_ANY_OUTPUT,
Expand Down Expand Up @@ -4325,7 +4325,7 @@ test_unscheduled()
static constexpr int QUANTUM_DURATION = 100; // Never reached.
static constexpr int BLOCK_LATENCY = 100;
static constexpr double BLOCK_SCALE = 1. / (BLOCK_LATENCY);
static constexpr int SWITCH_TIMEOUT = 2000;
static constexpr int SWITCH_TIMEOUT = 1000;
static constexpr memref_tid_t TID_BASE = 100;
static constexpr memref_tid_t TID_A = TID_BASE + 0;
static constexpr memref_tid_t TID_B = TID_BASE + 1;
Expand Down Expand Up @@ -4451,7 +4451,7 @@ test_unscheduled()
// has lapsed so it runs; finally we wait idle for C's long block to finish,
// after which C runs and *does not unschedule* b/c of B's prior request.
static const char *const CORE0_SCHED_STRING =
"...AA.........B........CC.....______________B......B......B....A......BBBB."
"...AA.........B........CC.....________B......B......B....A......BBBB.______"
"A._________________C......C.";

std::vector<scheduler_t::input_workload_t> sched_inputs;
Expand Down Expand Up @@ -4626,9 +4626,10 @@ test_unscheduled_fallback()
readers.emplace_back(std::unique_ptr<mock_reader_t>(new mock_reader_t(refs_C)),
std::unique_ptr<mock_reader_t>(new mock_reader_t()), TID_C);
// This looks like the schedule in test_unscheduled() up until "..A.." when
// we have a BLOCK_TIME_MAX-long idle period:
// we have an idle period equal to the rebalance_period from the start
// (so BLOCK_TIME_MAX minus what was run).
static const char *const CORE0_SCHED_STRING =
"...AA.........B........CC.....______________B......B....A.....______________"
"...AA.........B........CC.....__________________B......B....A.....__________"
"_________C._________________________________________________________________"
"____________________________________________________________________________"
"____________________________________________________________________________"
Expand Down
Loading