Index: runtime/vm/gc_sweeper.cc |
diff --git a/runtime/vm/gc_sweeper.cc b/runtime/vm/gc_sweeper.cc |
index 0dcf62fb276c7b944f512602fd4847b59aaf6d27..4d714bafd266da0040889afed0e76f7ae20660da 100644 |
--- a/runtime/vm/gc_sweeper.cc |
+++ b/runtime/vm/gc_sweeper.cc |
@@ -11,6 +11,7 @@ |
#include "vm/pages.h" |
#include "vm/safepoint.h" |
#include "vm/thread_pool.h" |
+#include "vm/timeline.h" |
namespace dart { |
@@ -116,30 +117,33 @@ class SweeperTask : public ThreadPool::Task { |
virtual void Run() { |
bool result = Thread::EnterIsolateAsHelper(task_isolate_); |
ASSERT(result); |
- Thread* thread = Thread::Current(); |
- GCSweeper sweeper; |
- |
- HeapPage* page = first_; |
- HeapPage* prev_page = NULL; |
- |
- while (page != NULL) { |
- thread->CheckForSafepoint(); |
- HeapPage* next_page = page->next(); |
- ASSERT(page->type() == HeapPage::kData); |
- bool page_in_use = sweeper.SweepPage(page, freelist_, false); |
- if (page_in_use) { |
- prev_page = page; |
- } else { |
- old_space_->FreePage(page, prev_page); |
- } |
- { |
- // Notify the mutator thread that we have added elements to the free |
- // list or that more capacity is available. |
- MonitorLocker ml(old_space_->tasks_lock()); |
- ml.Notify(); |
+ { |
+ Thread* thread = Thread::Current(); |
+ TimelineDurationScope tds(thread, Timeline::GetGCStream(), "SweeperTask"); |
+ GCSweeper sweeper; |
+ |
+ HeapPage* page = first_; |
+ HeapPage* prev_page = NULL; |
+ |
+ while (page != NULL) { |
+ thread->CheckForSafepoint(); |
+ HeapPage* next_page = page->next(); |
+ ASSERT(page->type() == HeapPage::kData); |
+ bool page_in_use = sweeper.SweepPage(page, freelist_, false); |
+ if (page_in_use) { |
+ prev_page = page; |
+ } else { |
+ old_space_->FreePage(page, prev_page); |
+ } |
+ { |
+ // Notify the mutator thread that we have added elements to the free |
+ // list or that more capacity is available. |
+ MonitorLocker ml(old_space_->tasks_lock()); |
+ ml.Notify(); |
+ } |
+ if (page == last_) break; |
+ page = next_page; |
} |
- if (page == last_) break; |
- page = next_page; |
} |
// Exit isolate cleanly *before* notifying it, to avoid shutdown race. |
Thread::ExitIsolateAsHelper(); |