diff --git a/clients/drcachesim/scheduler/scheduler.cpp b/clients/drcachesim/scheduler/scheduler.cpp index 66a1c351ca6..be923d5d135 100644 --- a/clients/drcachesim/scheduler/scheduler.cpp +++ b/clients/drcachesim/scheduler/scheduler.cpp @@ -830,6 +830,7 @@ scheduler_tmpl_t::read_traced_schedule() // We also need to translate the thread and cpu id values into 0-based ordinals. std::unordered_map tid2input; for (int i = 0; i < static_cast(inputs_.size()); ++i) { + VPRINT(this, 1, "tid2input: tid: %" PRId64 " -> %d\n", inputs_[i].tid, i); tid2input[inputs_[i].tid] = i; } std::vector> start2stop(inputs_.size()); @@ -857,6 +858,8 @@ scheduler_tmpl_t::read_traced_schedule() } } cur_cpu = entry.cpu; + VPRINT(this, 1, "Output #%d is CPU #%" PRId64 "\n", cur_output, cur_cpu); + outputs_[cur_output].cpu = (int)cur_cpu; } input_ordinal_t input = tid2input[entry.thread]; // We'll fill in the stop ordinal in our second pass below. diff --git a/clients/drcachesim/scheduler/scheduler.h b/clients/drcachesim/scheduler/scheduler.h index d1133275bee..903b8817c7a 100644 --- a/clients/drcachesim/scheduler/scheduler.h +++ b/clients/drcachesim/scheduler/scheduler.h @@ -790,6 +790,18 @@ template class scheduler_tmpl_t { return &outputs_[ordinal].stream; } + /** + * Returns the cpu number for the 'ordinal'-th output stream. This is only valid for + * MAP_TO_RECORDED_OUTPUT and returns -1 for other mappings. + */ + virtual int + get_output_cpuid(output_ordinal_t ordinal) + { + if (ordinal < 0 || ordinal >= static_cast(outputs_.size())) + return -1; + return outputs_[ordinal].cpu; + } + /** Returns the number of input streams. */ virtual int get_input_stream_count() const @@ -976,6 +988,7 @@ template class scheduler_tmpl_t { // sched_lock_. std::vector record; int record_index = 0; + int cpu = -1; bool waiting = false; bool active = true; // Used for time-based quanta.