| 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/file.h" | 7 #include "bin/file.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 void Benchmark::RunAll(const char* executable) { | 21 void Benchmark::RunAll(const char* executable) { |
| 22 SetExecutable(executable); | 22 SetExecutable(executable); |
| 23 Benchmark* benchmark = first_; | 23 Benchmark* benchmark = first_; |
| 24 while (benchmark != NULL) { | 24 while (benchmark != NULL) { |
| 25 benchmark->RunBenchmark(); | 25 benchmark->RunBenchmark(); |
| 26 benchmark = benchmark->next_; | 26 benchmark = benchmark->next_; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 // Compiler only implemented on IA32 and X64 now. | |
| 32 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | |
| 33 | |
| 34 | |
| 35 // | 31 // |
| 36 // Measure compile of all functions in dart core lib classes. | 32 // Measure compile of all functions in dart core lib classes. |
| 37 // | 33 // |
| 38 BENCHMARK(CorelibCompileAll) { | 34 BENCHMARK(CorelibCompileAll) { |
| 39 Timer timer(true, "Compile all of Core lib benchmark"); | 35 Timer timer(true, "Compile all of Core lib benchmark"); |
| 40 timer.Start(); | 36 timer.Start(); |
| 41 const Error& error = Error::Handle(benchmark->isolate(), | 37 const Error& error = Error::Handle(benchmark->isolate(), |
| 42 Library::CompileAll()); | 38 Library::CompileAll()); |
| 43 if (!error.IsNull()) { | 39 if (!error.IsNull()) { |
| 44 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", | 40 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", |
| 45 error.ToErrorCString()); | 41 error.ToErrorCString()); |
| 46 } | 42 } |
| 47 EXPECT(error.IsNull()); | 43 EXPECT(error.IsNull()); |
| 48 timer.Stop(); | 44 timer.Stop(); |
| 49 int64_t elapsed_time = timer.TotalElapsedTime(); | 45 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 50 benchmark->set_score(elapsed_time); | 46 benchmark->set_score(elapsed_time); |
| 51 } | 47 } |
| 52 | 48 |
| 53 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 | |
| 54 | |
| 55 | 49 |
| 56 // | 50 // |
| 57 // Measure creation of core isolate from a snapshot. | 51 // Measure creation of core isolate from a snapshot. |
| 58 // | 52 // |
| 59 BENCHMARK(CorelibIsolateStartup) { | 53 BENCHMARK(CorelibIsolateStartup) { |
| 60 const int kNumIterations = 100; | 54 const int kNumIterations = 100; |
| 61 char* err = NULL; | 55 char* err = NULL; |
| 62 Dart_Isolate base_isolate = Dart_CurrentIsolate(); | 56 Dart_Isolate base_isolate = Dart_CurrentIsolate(); |
| 63 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &err); | 57 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &err); |
| 64 EXPECT(test_isolate != NULL); | 58 EXPECT(test_isolate != NULL); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 442 |
| 449 // Write snapshot with object content. | 443 // Write snapshot with object content. |
| 450 FullSnapshotWriter writer(&buffer, &malloc_allocator); | 444 FullSnapshotWriter writer(&buffer, &malloc_allocator); |
| 451 writer.WriteFullSnapshot(); | 445 writer.WriteFullSnapshot(); |
| 452 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 446 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 453 ASSERT(snapshot->kind() == Snapshot::kFull); | 447 ASSERT(snapshot->kind() == Snapshot::kFull); |
| 454 benchmark->set_score(snapshot->length()); | 448 benchmark->set_score(snapshot->length()); |
| 455 } | 449 } |
| 456 | 450 |
| 457 } // namespace dart | 451 } // namespace dart |
| OLD | NEW |