Chromium Code Reviews| Index: runtime/vm/profiler_service.cc |
| diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc |
| index 5290e0697d0be85c47e5d1afba05d6069c55d92d..9f90beae374aa2a8fb2fbaceeeb6dde49c08f50f 100644 |
| --- a/runtime/vm/profiler_service.cc |
| +++ b/runtime/vm/profiler_service.cc |
| @@ -2670,16 +2670,18 @@ void ProfilerService::PrintJSONImpl(Thread* thread, |
| class NoAllocationSampleFilter : public SampleFilter { |
| public: |
| - NoAllocationSampleFilter(Isolate* isolate, |
| + NoAllocationSampleFilter(Dart_Port port, |
| intptr_t thread_task_mask, |
| int64_t time_origin_micros, |
| int64_t time_extent_micros) |
| - : SampleFilter(isolate, |
| + : SampleFilter(port, |
| thread_task_mask, |
| time_origin_micros, |
| time_extent_micros) {} |
| - bool FilterSample(Sample* sample) { return !sample->is_allocation_sample(); } |
| + bool FilterSample(Sample* sample) { |
| + return !sample->is_allocation_sample() && (sample->port() == ILLEGAL_PORT); |
|
Cutch
2017/02/22 23:15:55
is_allocation_sample is a different kind of sample
bkonyi
2017/02/23 00:25:20
Done.
|
| + } |
| }; |
| @@ -2690,7 +2692,7 @@ void ProfilerService::PrintJSON(JSONStream* stream, |
| int64_t time_extent_micros) { |
| Thread* thread = Thread::Current(); |
| Isolate* isolate = thread->isolate(); |
| - NoAllocationSampleFilter filter(isolate, Thread::kMutatorTask, |
| + NoAllocationSampleFilter filter(isolate->main_port(), Thread::kMutatorTask, |
| time_origin_micros, time_extent_micros); |
| const bool as_timeline = false; |
| PrintJSONImpl(thread, stream, tag_order, extra_tags, &filter, as_timeline); |
| @@ -2699,12 +2701,12 @@ void ProfilerService::PrintJSON(JSONStream* stream, |
| class ClassAllocationSampleFilter : public SampleFilter { |
| public: |
| - ClassAllocationSampleFilter(Isolate* isolate, |
| + ClassAllocationSampleFilter(Dart_Port port, |
| const Class& cls, |
| intptr_t thread_task_mask, |
| int64_t time_origin_micros, |
| int64_t time_extent_micros) |
| - : SampleFilter(isolate, |
| + : SampleFilter(port, |
| thread_task_mask, |
| time_origin_micros, |
| time_extent_micros), |
| @@ -2714,7 +2716,8 @@ class ClassAllocationSampleFilter : public SampleFilter { |
| bool FilterSample(Sample* sample) { |
| return sample->is_allocation_sample() && |
| - (sample->allocation_cid() == cls_.id()); |
| + (sample->allocation_cid() == cls_.id()) && |
| + (sample->port() == ILLEGAL_PORT); |
| } |
| private: |
| @@ -2722,6 +2725,20 @@ class ClassAllocationSampleFilter : public SampleFilter { |
| }; |
| +class NativeAllocationSampleFilter : public SampleFilter { |
| + public: |
| + NativeAllocationSampleFilter(Dart_Port port, |
| + intptr_t thread_task_mask, |
| + int64_t time_origin_micros, |
| + int64_t time_extent_micros) |
| + : SampleFilter(port, |
| + thread_task_mask, |
| + time_origin_micros, |
| + time_extent_micros) {} |
| + bool FilterSample(Sample* sample) { return (sample->port() == ILLEGAL_PORT); } |
|
Cutch
2017/02/22 23:15:56
return sample->is_native_allocation_sample();
bkonyi
2017/02/23 00:25:20
Done.
|
| +}; |
| + |
| + |
| void ProfilerService::PrintAllocationJSON(JSONStream* stream, |
| Profile::TagOrder tag_order, |
| const Class& cls, |
| @@ -2729,8 +2746,25 @@ void ProfilerService::PrintAllocationJSON(JSONStream* stream, |
| int64_t time_extent_micros) { |
| Thread* thread = Thread::Current(); |
| Isolate* isolate = thread->isolate(); |
| - ClassAllocationSampleFilter filter(isolate, cls, Thread::kMutatorTask, |
| - time_origin_micros, time_extent_micros); |
| + ClassAllocationSampleFilter filter(isolate->main_port(), cls, |
| + Thread::kMutatorTask, time_origin_micros, |
| + time_extent_micros); |
| + const bool as_timeline = false; |
| + PrintJSONImpl(thread, stream, tag_order, kNoExtraTags, &filter, as_timeline); |
| +} |
| + |
| + |
| +void ProfilerService::PrintNativeAllocationJSON(JSONStream* stream, |
| + Profile::TagOrder tag_order, |
| + int64_t time_origin_micros, |
| + int64_t time_extent_micros) { |
| + Thread* thread = Thread::Current(); |
| + Isolate* isolate = thread->isolate(); |
| + const intptr_t thread_task_mask = Thread::kMutatorTask | |
| + Thread::kCompilerTask | |
| + Thread::kSweeperTask | Thread::kMarkerTask; |
| + NativeAllocationSampleFilter filter(isolate->main_port(), thread_task_mask, |
| + time_origin_micros, time_extent_micros); |
| const bool as_timeline = false; |
| PrintJSONImpl(thread, stream, tag_order, kNoExtraTags, &filter, as_timeline); |
| } |
| @@ -2745,8 +2779,8 @@ void ProfilerService::PrintTimelineJSON(JSONStream* stream, |
| const intptr_t thread_task_mask = Thread::kMutatorTask | |
| Thread::kCompilerTask | |
| Thread::kSweeperTask | Thread::kMarkerTask; |
| - NoAllocationSampleFilter filter(isolate, thread_task_mask, time_origin_micros, |
| - time_extent_micros); |
| + NoAllocationSampleFilter filter(isolate->main_port(), thread_task_mask, |
| + time_origin_micros, time_extent_micros); |
| const bool as_timeline = true; |
| PrintJSONImpl(thread, stream, tag_order, kNoExtraTags, &filter, as_timeline); |
| } |