| 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" |
| 11 #include "platform/globals.h" |
| 11 | 12 |
| 12 #include "vm/dart_api_impl.h" | 13 #include "vm/dart_api_impl.h" |
| 13 #include "vm/stack_frame.h" | 14 #include "vm/stack_frame.h" |
| 14 #include "vm/unit_test.h" | 15 #include "vm/unit_test.h" |
| 15 | 16 |
| 16 using dart::bin::File; | 17 using dart::bin::File; |
| 17 | 18 |
| 18 namespace dart { | 19 namespace dart { |
| 19 | 20 |
| 20 Benchmark* Benchmark::first_ = NULL; | 21 Benchmark* Benchmark::first_ = NULL; |
| 21 Benchmark* Benchmark::tail_ = NULL; | 22 Benchmark* Benchmark::tail_ = NULL; |
| 22 const char* Benchmark::executable_ = NULL; | 23 const char* Benchmark::executable_ = NULL; |
| 23 | 24 |
| 24 void Benchmark::RunAll(const char* executable) { | 25 void Benchmark::RunAll(const char* executable) { |
| 25 SetExecutable(executable); | 26 SetExecutable(executable); |
| 26 Benchmark* benchmark = first_; | 27 Benchmark* benchmark = first_; |
| 27 while (benchmark != NULL) { | 28 while (benchmark != NULL) { |
| 28 benchmark->RunBenchmark(); | 29 benchmark->RunBenchmark(); |
| 29 benchmark = benchmark->next_; | 30 benchmark = benchmark->next_; |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 34 // TODO(zra): Remove when tests are ready to enable. |
| 35 #if !defined(TARGET_ARCH_ARM64) |
| 33 | 36 |
| 34 // | 37 // |
| 35 // Measure compile of all functions in dart core lib classes. | 38 // Measure compile of all functions in dart core lib classes. |
| 36 // | 39 // |
| 37 BENCHMARK(CorelibCompileAll) { | 40 BENCHMARK(CorelibCompileAll) { |
| 38 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 41 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
| 39 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); | 42 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); |
| 40 Timer timer(true, "Compile all of Core lib benchmark"); | 43 Timer timer(true, "Compile all of Core lib benchmark"); |
| 41 timer.Start(); | 44 timer.Start(); |
| 42 const Error& error = Error::Handle(benchmark->isolate(), | 45 const Error& error = Error::Handle(benchmark->isolate(), |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 // Read object back from the snapshot. | 574 // Read object back from the snapshot. |
| 572 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); | 575 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); |
| 573 reader.ReadObject(); | 576 reader.ReadObject(); |
| 574 free(buffer); | 577 free(buffer); |
| 575 } | 578 } |
| 576 timer.Stop(); | 579 timer.Stop(); |
| 577 int64_t elapsed_time = timer.TotalElapsedTime(); | 580 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 578 benchmark->set_score(elapsed_time); | 581 benchmark->set_score(elapsed_time); |
| 579 } | 582 } |
| 580 | 583 |
| 584 #endif // !defined(TARGET_ARCH_ARM64) |
| 585 |
| 581 } // namespace dart | 586 } // namespace dart |
| OLD | NEW |