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

Unified Diff: runtime/vm/profiler.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/profiler.h ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index e05ad925d3cde8e23a298bf50f3f7560bc96e9bc..1b589d91a2c924f9a386d2a587a294ca09ad9e36 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -844,6 +844,10 @@ static Sample* SetupSample(Thread* thread,
#endif
sample->set_vm_tag(vm_tag);
sample->set_user_tag(isolate->user_tag());
+ // TODO(rmacnak): Consider tracking the current Task kind so the profiler
+ // can say the program spent x% of cpu time in the main thread, GC,
+ // background compilation, etc.
+ sample->set_is_mutator_thread(thread->IsMutatorThread());
return sample;
}
@@ -985,12 +989,6 @@ void Profiler::SampleThread(Thread* thread,
return;
}
- if (!thread->IsMutatorThread()) {
- // Not a mutator thread.
- // TODO(johnmccutchan): Profile all threads with an isolate.
- return;
- }
-
uword stack_lower = 0;
uword stack_upper = 0;
if (!GetAndValidateIsolateStackBounds(thread,
@@ -1015,7 +1013,9 @@ void Profiler::SampleThread(Thread* thread,
// Increment counter for vm tag.
VMTagCounters* counters = isolate->vm_tag_counters();
ASSERT(counters != NULL);
- counters->Increment(sample->vm_tag());
+ if (thread->IsMutatorThread()) {
+ counters->Increment(sample->vm_tag());
+ }
ProfilerNativeStackWalker native_stack_walker(isolate,
sample,
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/profiler_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698