Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: runtime/vm/gc_sweeper.cc

Issue 1814813003: Collect samples for background threads. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698