Add rust_dom::log_state, for logging the running/blocked/dead vectors per scheduling iteration.

This commit is contained in:
Michael Bebenita 2010-07-28 14:53:08 -07:00 committed by Graydon Hoare
parent 5db5eb0c55
commit 30b3f8a117
2 changed files with 32 additions and 0 deletions

View file

@ -282,6 +282,32 @@ rust_dom::schedule_task()
return NULL;
}
void
rust_dom::log_state() {
if (!running_tasks.is_empty()) {
log(rust_log::TASK, "running tasks:");
for (size_t i = 0; i < running_tasks.length(); i++) {
log(rust_log::TASK,
"\t task: 0x%" PRIxPTR, running_tasks[i]);
}
}
if (!blocked_tasks.is_empty()) {
log(rust_log::TASK, "blocked tasks:");
for (size_t i = 0; i < blocked_tasks.length(); i++) {
log(rust_log::TASK,
"\t task: 0x%" PRIxPTR ", blocked on: 0x%" PRIxPTR,
blocked_tasks[i], blocked_tasks[i]->cond);
}
}
if (!dead_tasks.is_empty()) {
log(rust_log::TASK, "dead tasks:");
for (size_t i = 0; i < dead_tasks.length(); i++) {
log(rust_log::TASK, "\t task: 0x%" PRIxPTR, dead_tasks[i]);
}
}
}
/**
* Starts the main scheduler loop which performs task scheduling for this
* domain.
@ -307,7 +333,11 @@ rust_dom::start_main_loop()
if (scheduled_task == NULL) {
log(rust_log::TASK,
"all tasks are blocked, waiting for progress ...");
if (_log.is_tracing(rust_log::TASK))
log_state();
_progress.wait();
log(rust_log::TASK,
"progress made, resuming ...");
continue;
}

View file

@ -88,6 +88,8 @@ struct rust_dom
void reap_dead_tasks();
rust_task *schedule_task();
int start_main_loop();
void log_state();
};
//