Index: runtime/vm/benchmark_test.cc |
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc |
index 62c04de02ec2802ce618e576756839cac7e150b9..94d8baf011a7e821c580c5f42308ca2693ff197f 100644 |
--- a/runtime/vm/benchmark_test.cc |
+++ b/runtime/vm/benchmark_test.cc |
@@ -482,4 +482,24 @@ BENCHMARK(CreateMirrorSystem) { |
benchmark->set_score(elapsed_time); |
} |
+ |
+BENCHMARK(EnterExitIsolate) { |
+ const char* kScriptChars = |
+ "import 'dart:core';\n" |
+ "\n"; |
+ const intptr_t kLoopCount = 1000000; |
+ TestCase::LoadTestScript(kScriptChars, NULL); |
+ Api::CheckIsolateState(Isolate::Current()); |
+ Dart_Isolate isolate = Dart_CurrentIsolate(); |
+ Timer timer(true, "Enter and Exit isolate"); |
+ timer.Start(); |
+ for (intptr_t i = 0; i < kLoopCount; i++) { |
+ Dart_ExitIsolate(); |
+ Dart_EnterIsolate(isolate); |
+ } |
+ timer.Stop(); |
+ int64_t elapsed_time = timer.TotalElapsedTime(); |
+ benchmark->set_score(elapsed_time); |
+} |
+ |
} // namespace dart |