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

Unified Diff: runtime/vm/profiler_service.cc

Issue 2680213002: Updated MallocHooks to collect stack traces when memory is allocated. (Closed)
Patch Set: Updated MallocHooks to collect stack traces when memory is allocated. Created 3 years, 10 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_service.h ('k') | runtime/vm/profiler_test.cc » ('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 5290e0697d0be85c47e5d1afba05d6069c55d92d..8b9bee9489e861ece363d122e87e3e01413d9711 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -2670,16 +2670,19 @@ 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->is_native_allocation_sample();
+ }
};
@@ -2690,7 +2693,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 +2702,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),
@@ -2722,6 +2725,21 @@ class ClassAllocationSampleFilter : public SampleFilter {
};
+class NativeAllocationSampleFilter : public SampleFilter {
+ public:
+ NativeAllocationSampleFilter(intptr_t thread_task_mask,
+ int64_t time_origin_micros,
+ int64_t time_extent_micros)
+ : SampleFilter(ILLEGAL_PORT,
+ thread_task_mask,
+ time_origin_micros,
+ time_extent_micros) {}
+ bool FilterSample(Sample* sample) {
+ return sample->is_native_allocation_sample();
+ }
+};
+
+
void ProfilerService::PrintAllocationJSON(JSONStream* stream,
Profile::TagOrder tag_order,
const Class& cls,
@@ -2729,8 +2747,24 @@ 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();
+ const intptr_t thread_task_mask = Thread::kMutatorTask |
+ Thread::kCompilerTask |
+ Thread::kSweeperTask | Thread::kMarkerTask;
+ NativeAllocationSampleFilter filter(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);
}
« no previous file with comments | « runtime/vm/profiler_service.h ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698