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: Print configuration at startup #7020

Merged
merged 1 commit into from
Oct 3, 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
62 changes: 60 additions & 2 deletions clients/drcachesim/scheduler/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,63 @@ scheduler_tmpl_t<RecordType, ReaderType>::stream_t::set_active(bool active)
* Scheduler.
*/

template <typename RecordType, typename ReaderType>
void
scheduler_tmpl_t<RecordType, ReaderType>::print_configuration()
{
VPRINT(this, 1, "Scheduler configuration:\n");
VPRINT(this, 1, " %-25s : %zu\n", "Inputs", inputs_.size());
VPRINT(this, 1, " %-25s : %zu\n", "Outputs", outputs_.size());
VPRINT(this, 1, " %-25s : %d\n", "mapping", options_.mapping);
VPRINT(this, 1, " %-25s : %d\n", "deps", options_.deps);
VPRINT(this, 1, " %-25s : 0x%08x\n", "flags", options_.flags);
VPRINT(this, 1, " %-25s : %d\n", "quantum_unit", options_.quantum_unit);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "quantum_duration",
options_.quantum_duration);
VPRINT(this, 1, " %-25s : %d\n", "verbosity", options_.verbosity);
VPRINT(this, 1, " %-25s : %p\n", "schedule_record_ostream",
options_.schedule_record_ostream);
VPRINT(this, 1, " %-25s : %p\n", "schedule_replay_istream",
options_.schedule_replay_istream);
VPRINT(this, 1, " %-25s : %p\n", "replay_as_traced_istream",
options_.replay_as_traced_istream);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "syscall_switch_threshold",
options_.syscall_switch_threshold);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "blocking_switch_threshold",
options_.blocking_switch_threshold);
VPRINT(this, 1, " %-25s : %f\n", "block_time_scale", options_.block_time_scale);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "block_time_max", options_.block_time_max);
VPRINT(this, 1, " %-25s : %s\n", "kernel_switch_trace_path",
options_.kernel_switch_trace_path.c_str());
VPRINT(this, 1, " %-25s : %p\n", "kernel_switch_reader",
options_.kernel_switch_reader.get());
VPRINT(this, 1, " %-25s : %p\n", "kernel_switch_reader_end",
options_.kernel_switch_reader_end.get());
VPRINT(this, 1, " %-25s : %d\n", "single_lockstep_output",
options_.single_lockstep_output);
VPRINT(this, 1, " %-25s : %d\n", "randomize_next_input",
options_.randomize_next_input);
VPRINT(this, 1, " %-25s : %d\n", "read_inputs_in_init",
options_.read_inputs_in_init);
VPRINT(this, 1, " %-25s : %d\n", "honor_direct_switches",
options_.honor_direct_switches);
VPRINT(this, 1, " %-25s : %f\n", "time_units_per_us", options_.time_units_per_us);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "quantum_duration_us",
options_.quantum_duration_us);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "quantum_duration_instrs",
options_.quantum_duration_instrs);
VPRINT(this, 1, " %-25s : %f\n", "block_time_multiplier",
options_.block_time_multiplier);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "block_time_max_us",
options_.block_time_max_us);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "migration_threshold_us",
options_.migration_threshold_us);
VPRINT(this, 1, " %-25s : %" PRIu64 "\n", "rebalance_period_us",
options_.rebalance_period_us);
VPRINT(this, 1, " %-25s : %d\n", "honor_infinite_timeouts",
options_.honor_infinite_timeouts);
}

template <typename RecordType, typename ReaderType>
scheduler_tmpl_t<RecordType, ReaderType>::~scheduler_tmpl_t()
{
Expand Down Expand Up @@ -899,7 +956,9 @@ scheduler_tmpl_t<RecordType, ReaderType>::init(
}
}
}
VPRINT(this, 1, "%zu inputs\n", inputs_.size());

VDO(this, 1, { print_configuration(); });

live_input_count_.store(static_cast<int>(inputs_.size()), std::memory_order_release);

res = read_switch_sequences();
Expand Down Expand Up @@ -3111,7 +3170,6 @@ typename scheduler_tmpl_t<RecordType, ReaderType>::stream_status_t
scheduler_tmpl_t<RecordType, ReaderType>::pick_next_input(output_ordinal_t output,
uint64_t blocked_time)
{

sched_type_t::stream_status_t res = sched_type_t::STATUS_OK;
const input_ordinal_t prev_index = outputs_[output].cur_input;
input_ordinal_t index = INVALID_INPUT_ORDINAL;
Expand Down
5 changes: 5 additions & 0 deletions clients/drcachesim/scheduler/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ template <typename RecordType, typename ReaderType> class scheduler_tmpl_t {
* (#block_time_max_us) scaled by #block_time_multiplier.
*/
bool honor_infinite_timeouts = false;
// When adding new options, also add to print_configuration().
};

/**
Expand Down Expand Up @@ -1732,6 +1733,10 @@ template <typename RecordType, typename ReaderType> class scheduler_tmpl_t {
scheduler_status_t
get_initial_input_content(bool gather_timestamps);

// Dumps the options, for diagnostics.
void
print_configuration();

// Allow subclasses to perform custom initial marker processing during
// get_initial_input_content(). Returns whether to keep reading.
// The caller will stop calling when an instruction record is reached.
Expand Down
Loading