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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 | 458 |
| 459 BENCHMARK(CreateMirrorSystem) { | 459 BENCHMARK(CreateMirrorSystem) { |
| 460 const char* kScriptChars = | 460 const char* kScriptChars = |
| 461 "import 'dart:mirrors';\n" | 461 "import 'dart:mirrors';\n" |
| 462 "\n" | 462 "\n" |
| 463 "void benchmark() {\n" | 463 "void benchmark() {\n" |
| 464 " currentMirrorSystem();\n" | 464 " currentMirrorSystem();\n" |
| 465 "}\n"; | 465 "}\n"; |
| 466 | 466 |
| 467 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 467 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 468 Dart_Handle args[0]; | 468 Dart_Handle args[1]; |
| 469 | 469 |
| 470 Timer timer(true, "currentMirrorSystem() benchmark"); | 470 Timer timer(true, "currentMirrorSystem() benchmark"); |
| 471 timer.Start(); | 471 timer.Start(); |
| 472 Dart_Invoke(lib, NewString("benchmark"), 0, args); | 472 Dart_Invoke(lib, NewString("benchmark"), 0, args); |
|
Søren Gjesse
2013/07/25 09:33:09
Can't args just be NULL here when the number is 0?
Bill Hesse
2013/07/25 09:37:57
Yes it can. It is not documented in dart_api.h, b
| |
| 473 timer.Stop(); | 473 timer.Stop(); |
| 474 int64_t elapsed_time = timer.TotalElapsedTime(); | 474 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 475 benchmark->set_score(elapsed_time); | 475 benchmark->set_score(elapsed_time); |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace dart | 478 } // namespace dart |
| OLD | NEW |