| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 // | 55 // |
| 56 // Measure creation of core isolate from a snapshot. | 56 // Measure creation of core isolate from a snapshot. |
| 57 // | 57 // |
| 58 BENCHMARK(CorelibIsolateStartup) { | 58 BENCHMARK(CorelibIsolateStartup) { |
| 59 const int kNumIterations = 100; | 59 const int kNumIterations = 100; |
| 60 char* err = NULL; | 60 char* err = NULL; |
| 61 Dart_Isolate base_isolate = Dart_CurrentIsolate(); | 61 Dart_Isolate base_isolate = Dart_CurrentIsolate(); |
| 62 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &err); | 62 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, |
| 63 bin::snapshot_buffer, |
| 64 NULL, &err); |
| 63 EXPECT(test_isolate != NULL); | 65 EXPECT(test_isolate != NULL); |
| 64 Dart_EnterScope(); | 66 Dart_EnterScope(); |
| 65 uint8_t* buffer = NULL; | 67 uint8_t* buffer = NULL; |
| 66 intptr_t size = 0; | 68 intptr_t size = 0; |
| 67 Dart_Handle result = Dart_CreateSnapshot(&buffer, &size); | 69 Dart_Handle result = Dart_CreateSnapshot(&buffer, &size); |
| 68 EXPECT_VALID(result); | 70 EXPECT_VALID(result); |
| 69 Timer timer(true, "Core Isolate startup benchmark"); | 71 Timer timer(true, "Core Isolate startup benchmark"); |
| 70 timer.Start(); | 72 timer.Start(); |
| 71 for (int i = 0; i < kNumIterations; i++) { | 73 for (int i = 0; i < kNumIterations; i++) { |
| 72 Dart_Isolate new_isolate = | 74 Dart_Isolate new_isolate = |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 449 |
| 448 // Write snapshot with object content. | 450 // Write snapshot with object content. |
| 449 FullSnapshotWriter writer(&buffer, &malloc_allocator); | 451 FullSnapshotWriter writer(&buffer, &malloc_allocator); |
| 450 writer.WriteFullSnapshot(); | 452 writer.WriteFullSnapshot(); |
| 451 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 453 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 452 ASSERT(snapshot->kind() == Snapshot::kFull); | 454 ASSERT(snapshot->kind() == Snapshot::kFull); |
| 453 benchmark->set_score(snapshot->length()); | 455 benchmark->set_score(snapshot->length()); |
| 454 } | 456 } |
| 455 | 457 |
| 456 } // namespace dart | 458 } // namespace dart |
| OLD | NEW |