diff options
| author | Michael Bebenita <mbebenita@mozilla.com> | 2010-08-09 07:34:11 -0700 |
|---|---|---|
| committer | Michael Bebenita <mbebenita@mozilla.com> | 2010-08-09 07:34:11 -0700 |
| commit | 56cd4e458a6c3cd40a8ee2ceb0a0fdab0352bf20 (patch) | |
| tree | bdc9c70bf64dc46a9838c38afa42673198ed3c67 /src/rt/rust_dom.cpp | |
| parent | c5744c8aefa1c9f74e779af2c5ceb852640b28b7 (diff) | |
| download | rust-56cd4e458a6c3cd40a8ee2ceb0a0fdab0352bf20.tar.gz rust-56cd4e458a6c3cd40a8ee2ceb0a0fdab0352bf20.zip | |
Made the runtime keep track of all live domains and print their state.
Diffstat (limited to 'src/rt/rust_dom.cpp')
| -rw-r--r-- | src/rt/rust_dom.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index 99aaddb2b15..97e327463c3 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -4,6 +4,8 @@ template class ptr_vec<rust_task>; +// Keeps track of all live domains, for debugging purposes. +array_list<rust_dom*> _live_domains; rust_dom::rust_dom(rust_srv *srv, rust_crate const *root_crate) : interrupt_flag(0), @@ -26,6 +28,10 @@ rust_dom::rust_dom(rust_srv *srv, rust_crate const *root_crate) : pthread_attr_setdetachstate(&attr, true); #endif root_task = new (this) rust_task(this, NULL); + + if (_live_domains.replace(NULL, this) == false) { + _live_domains.append(this); + } } static void @@ -73,6 +79,8 @@ rust_dom::~rust_dom() { #endif while (caches.length()) delete caches.pop(); + + _live_domains.replace(this, NULL); } void @@ -322,6 +330,13 @@ rust_dom::schedule_task() } void +rust_dom::log_all_state() { + for (uint32_t i = 0; i < _live_domains.size(); i++) { + _live_domains[i]->log_state(); + } +} + +void rust_dom::log_state() { if (!running_tasks.is_empty()) { log(rust_log::TASK, "running tasks:"); |
