Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/benchmark_test.h" | 5 #include "vm/benchmark_test.h" |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 475 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 476 | 476 |
| 477 Timer timer(true, "currentMirrorSystem() benchmark"); | 477 Timer timer(true, "currentMirrorSystem() benchmark"); |
| 478 timer.Start(); | 478 timer.Start(); |
| 479 Dart_Invoke(lib, NewString("benchmark"), 0, NULL); | 479 Dart_Invoke(lib, NewString("benchmark"), 0, NULL); |
| 480 timer.Stop(); | 480 timer.Stop(); |
| 481 int64_t elapsed_time = timer.TotalElapsedTime(); | 481 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 482 benchmark->set_score(elapsed_time); | 482 benchmark->set_score(elapsed_time); |
| 483 } | 483 } |
| 484 | 484 |
| 485 | |
| 486 BENCHMARK(EnterExitIsolate) { | |
| 487 const char* kScriptChars = | |
| 488 "import 'dart:core';\n" | |
| 489 "\n"; | |
| 490 const intptr_t kLoopCount = 1000000; | |
| 491 TestCase::LoadTestScript(kScriptChars, NULL); | |
| 492 Api::CheckIsolateState(Isolate::Current()); | |
| 493 Dart_Isolate isolate = Dart_CurrentIsolate(); | |
| 494 Timer timer(true, "Enter and Exit isolate"); | |
| 495 timer.Start(); | |
| 496 for (intptr_t i = 0; i < kLoopCount; i++) { | |
| 497 Dart_ExitIsolate(); | |
| 498 Dart_EnterIsolate(isolate); | |
| 499 } | |
| 500 timer.Stop(); | |
| 501 int64_t elapsed_time = timer.TotalElapsedTime(); | |
| 502 benchmark->set_score(elapsed_time); | |
| 503 } | |
|
siva
2014/02/06 00:37:24
To get this running on go/darta you will have to a
| |
| 504 | |
| 485 } // namespace dart | 505 } // namespace dart |
| OLD | NEW |