aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-07-28 14:53:08 -0700
committerGraydon Hoare <[email protected]>2010-07-28 20:30:29 -0700
commit30b3f8a11713e32fdb0d0059141289152a46d501 (patch)
treeabf0d4a9299e494db4993fca0ec75c63fad7d052
parentNull rust_task::cond on wakeup, add asserts and logging to block/wakeup. (diff)
downloadrust-30b3f8a11713e32fdb0d0059141289152a46d501.tar.xz
rust-30b3f8a11713e32fdb0d0059141289152a46d501.zip
Add rust_dom::log_state, for logging the running/blocked/dead vectors per scheduling iteration.
-rw-r--r--src/rt/rust_dom.cpp30
-rw-r--r--src/rt/rust_dom.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp
index 7392833d..17cb1498 100644
--- a/src/rt/rust_dom.cpp
+++ b/src/rt/rust_dom.cpp
@@ -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;
}
diff --git a/src/rt/rust_dom.h b/src/rt/rust_dom.h
index 77faa61d..8247cbbd 100644
--- a/src/rt/rust_dom.h
+++ b/src/rt/rust_dom.h
@@ -88,6 +88,8 @@ struct rust_dom
void reap_dead_tasks();
rust_task *schedule_task();
int start_main_loop();
+
+ void log_state();
};
//