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

Unified Diff: runtime/vm/profiler_service.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.cc ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_service.cc
diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
index 35fd7712c23c8eaad2787d5ac4ac9e27140d0f3a..9cfce3d23f921384e30efab2c4dc4df79ce09e06 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -2497,16 +2497,24 @@ void ProfilerService::PrintJSONImpl(Thread* thread,
class NoAllocationSampleFilter : public SampleFilter {
public:
NoAllocationSampleFilter(Isolate* isolate,
+ bool include_background_samples,
int64_t time_origin_micros,
int64_t time_extent_micros)
: SampleFilter(isolate,
time_origin_micros,
- time_extent_micros) {
+ time_extent_micros),
+ include_background_samples_(include_background_samples) {
}
bool FilterSample(Sample* sample) {
- return !sample->is_allocation_sample();
+ if (sample->is_allocation_sample()) {
+ return false;
+ }
+ return sample->is_mutator_thread() || include_background_samples_;
}
+
+ private:
+ const bool include_background_samples_;
};
@@ -2517,7 +2525,9 @@ void ProfilerService::PrintJSON(JSONStream* stream,
int64_t time_extent_micros) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
+ const bool include_background_samples = false;
NoAllocationSampleFilter filter(isolate,
+ include_background_samples,
time_origin_micros,
time_extent_micros);
const bool as_timeline = false;
@@ -2570,7 +2580,9 @@ void ProfilerService::PrintTimelineJSON(JSONStream* stream,
int64_t time_extent_micros) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
+ const bool include_background_samples = true;
NoAllocationSampleFilter filter(isolate,
+ include_background_samples,
time_origin_micros,
time_extent_micros);
const bool as_timeline = true;
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698