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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 297183003: Reduce CPU usage when no isolates need to be profiled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 4c04cba04ea5fe673abe48b4a715201a6fefb073..5368495d2ba66471e8c59dbf6cf763662f862f2a 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -25,6 +25,7 @@
#include "vm/object.h"
#include "vm/object_store.h"
#include "vm/port.h"
+#include "vm/profiler.h"
#include "vm/resolver.h"
#include "vm/reusable_handles.h"
#include "vm/service.h"
@@ -5028,6 +5029,30 @@ DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer) {
}
+// --- Profiler support ---
+
+DART_EXPORT void Dart_BlockProfiler() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ IsolateProfilerData* profiler_data = isolate->profiler_data();
+ if (profiler_data == NULL) {
+ return;
+ }
+ profiler_data->Block();
+}
+
+
+DART_EXPORT void Dart_UnblockProfiler() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ IsolateProfilerData* profiler_data = isolate->profiler_data();
+ if (profiler_data == NULL) {
+ return;
+ }
+ profiler_data->Unblock();
+}
+
+
// --- Service support ---
DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) {

Powered by Google App Engine
This is Rietveld 408576698