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

Unified Diff: runtime/vm/profiler_service.cc

Issue 1425093006: Revert "Switch profiler from isolates to threads" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/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 d59108ba3d42efafbd79e80c9c0d15c7abaa3d7f..38118a60c8e405b2e025fa18f3f2e947338bb066 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -1051,7 +1051,13 @@ class ProfileBuilder : public ValueObject {
void FilterSamples() {
ScopeTimer sw("ProfileBuilder::FilterSamples", FLAG_trace_profiler);
- SampleBuffer* sample_buffer = Profiler::sample_buffer();
+ Isolate* isolate = thread_->isolate();
+ MutexLocker profiler_data_lock(isolate->profiler_data_mutex());
+ IsolateProfilerData* profiler_data = isolate->profiler_data();
+ if (profiler_data == NULL) {
+ return;
+ }
+ SampleBuffer* sample_buffer = profiler_data->sample_buffer();
if (sample_buffer == NULL) {
return;
}
@@ -2213,13 +2219,16 @@ void ProfilerService::PrintJSONImpl(Thread* thread,
intptr_t extra_tags,
SampleFilter* filter) {
Isolate* isolate = thread->isolate();
- // Disable thread interrupts while processing the buffer.
- DisableThreadInterruptsScope dtis(thread);
+ // Disable profile interrupts while processing the buffer.
+ Profiler::EndExecution(isolate);
- SampleBuffer* sample_buffer = Profiler::sample_buffer();
- if (sample_buffer == NULL) {
- stream->PrintError(kFeatureDisabled, NULL);
- return;
+ {
+ MutexLocker profiler_data_lock(isolate->profiler_data_mutex());
+ IsolateProfilerData* profiler_data = isolate->profiler_data();
+ if (profiler_data == NULL) {
+ stream->PrintError(kFeatureDisabled, NULL);
+ return;
+ }
}
{
@@ -2229,6 +2238,9 @@ void ProfilerService::PrintJSONImpl(Thread* thread,
profile.Build(thread, filter, tag_order, extra_tags);
profile.PrintJSON(stream);
}
+
+ // Enable profile interrupts.
+ Profiler::BeginExecution(isolate);
}
@@ -2283,19 +2295,24 @@ void ProfilerService::PrintAllocationJSON(JSONStream* stream,
void ProfilerService::ClearSamples() {
- SampleBuffer* sample_buffer = Profiler::sample_buffer();
- if (sample_buffer == NULL) {
- return;
- }
+ Isolate* isolate = Isolate::Current();
- Thread* thread = Thread::Current();
- Isolate* isolate = thread->isolate();
+ // Disable profile interrupts while processing the buffer.
+ Profiler::EndExecution(isolate);
- // Disable thread interrupts while processing the buffer.
- DisableThreadInterruptsScope dtis(thread);
+ MutexLocker profiler_data_lock(isolate->profiler_data_mutex());
+ IsolateProfilerData* profiler_data = isolate->profiler_data();
+ if (profiler_data == NULL) {
+ return;
+ }
+ SampleBuffer* sample_buffer = profiler_data->sample_buffer();
+ ASSERT(sample_buffer != NULL);
ClearProfileVisitor clear_profile(isolate);
sample_buffer->VisitSamples(&clear_profile);
+
+ // Enable profile interrupts.
+ Profiler::BeginExecution(isolate);
}
} // namespace dart
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698