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 #include "bin/isolate_data.h" | 9 #include "bin/isolate_data.h" |
10 | 10 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 514 |
515 // Start an Isolate, load a script and create a full snapshot. | 515 // Start an Isolate, load a script and create a full snapshot. |
516 uint8_t* vm_snapshot_data_buffer; | 516 uint8_t* vm_snapshot_data_buffer; |
517 uint8_t* isolate_snapshot_data_buffer; | 517 uint8_t* isolate_snapshot_data_buffer; |
518 // Need to load the script into the dart: core library due to | 518 // Need to load the script into the dart: core library due to |
519 // the import of dart:_internal. | 519 // the import of dart:_internal. |
520 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 520 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
521 Api::CheckAndFinalizePendingClasses(thread); | 521 Api::CheckAndFinalizePendingClasses(thread); |
522 | 522 |
523 // Write snapshot with object content. | 523 // Write snapshot with object content. |
524 FullSnapshotWriter writer(Snapshot::kCore, &vm_snapshot_data_buffer, | 524 FullSnapshotWriter writer(Snapshot::kFull, &vm_snapshot_data_buffer, |
525 &isolate_snapshot_data_buffer, &malloc_allocator, | 525 &isolate_snapshot_data_buffer, &malloc_allocator, |
526 NULL, NULL /* image_writer */); | 526 NULL, NULL /* image_writer */); |
527 writer.WriteFullSnapshot(); | 527 writer.WriteFullSnapshot(); |
528 const Snapshot* snapshot = | 528 const Snapshot* snapshot = |
529 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); | 529 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); |
530 ASSERT(snapshot->kind() == Snapshot::kCore); | 530 ASSERT(snapshot->kind() == Snapshot::kFull); |
531 benchmark->set_score(snapshot->length()); | 531 benchmark->set_score(snapshot->length()); |
532 | 532 |
533 free(vm_snapshot_data_buffer); | 533 free(vm_snapshot_data_buffer); |
534 free(isolate_snapshot_data_buffer); | 534 free(isolate_snapshot_data_buffer); |
535 } | 535 } |
536 | 536 |
537 | 537 |
538 BENCHMARK_SIZE(StandaloneSnapshotSize) { | 538 BENCHMARK_SIZE(StandaloneSnapshotSize) { |
539 const char* kScriptChars = | 539 const char* kScriptChars = |
540 "import 'dart:async';\n" | 540 "import 'dart:async';\n" |
(...skipping 11 matching lines...) Expand all Loading... |
552 | 552 |
553 // Start an Isolate, load a script and create a full snapshot. | 553 // Start an Isolate, load a script and create a full snapshot. |
554 uint8_t* vm_snapshot_data_buffer; | 554 uint8_t* vm_snapshot_data_buffer; |
555 uint8_t* isolate_snapshot_data_buffer; | 555 uint8_t* isolate_snapshot_data_buffer; |
556 // Need to load the script into the dart: core library due to | 556 // Need to load the script into the dart: core library due to |
557 // the import of dart:_internal. | 557 // the import of dart:_internal. |
558 TestCase::LoadCoreTestScript(kScriptChars, NULL); | 558 TestCase::LoadCoreTestScript(kScriptChars, NULL); |
559 Api::CheckAndFinalizePendingClasses(thread); | 559 Api::CheckAndFinalizePendingClasses(thread); |
560 | 560 |
561 // Write snapshot with object content. | 561 // Write snapshot with object content. |
562 FullSnapshotWriter writer(Snapshot::kCore, &vm_snapshot_data_buffer, | 562 FullSnapshotWriter writer(Snapshot::kFull, &vm_snapshot_data_buffer, |
563 &isolate_snapshot_data_buffer, &malloc_allocator, | 563 &isolate_snapshot_data_buffer, &malloc_allocator, |
564 NULL, NULL /* image_writer */); | 564 NULL, NULL /* image_writer */); |
565 writer.WriteFullSnapshot(); | 565 writer.WriteFullSnapshot(); |
566 const Snapshot* snapshot = | 566 const Snapshot* snapshot = |
567 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); | 567 Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer); |
568 ASSERT(snapshot->kind() == Snapshot::kCore); | 568 ASSERT(snapshot->kind() == Snapshot::kFull); |
569 benchmark->set_score(snapshot->length()); | 569 benchmark->set_score(snapshot->length()); |
570 | 570 |
571 free(vm_snapshot_data_buffer); | 571 free(vm_snapshot_data_buffer); |
572 free(isolate_snapshot_data_buffer); | 572 free(isolate_snapshot_data_buffer); |
573 } | 573 } |
574 | 574 |
575 | 575 |
576 BENCHMARK(CreateMirrorSystem) { | 576 BENCHMARK(CreateMirrorSystem) { |
577 const char* kScriptChars = | 577 const char* kScriptChars = |
578 "import 'dart:mirrors';\n" | 578 "import 'dart:mirrors';\n" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 int64_t elapsed_time = timer.TotalElapsedTime(); | 725 int64_t elapsed_time = timer.TotalElapsedTime(); |
726 benchmark->set_score(elapsed_time); | 726 benchmark->set_score(elapsed_time); |
727 } | 727 } |
728 | 728 |
729 | 729 |
730 BENCHMARK_MEMORY(InitialRSS) { | 730 BENCHMARK_MEMORY(InitialRSS) { |
731 benchmark->set_score(OS::MaxRSS()); | 731 benchmark->set_score(OS::MaxRSS()); |
732 } | 732 } |
733 | 733 |
734 } // namespace dart | 734 } // namespace dart |
OLD | NEW |