Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: runtime/vm/benchmark_test.cc

Issue 319833004: Simplifies CorelibIsolateStartup benchmark, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 timer.Stop(); 50 timer.Stop();
51 int64_t elapsed_time = timer.TotalElapsedTime(); 51 int64_t elapsed_time = timer.TotalElapsedTime();
52 benchmark->set_score(elapsed_time); 52 benchmark->set_score(elapsed_time);
53 } 53 }
54 54
55 55
56 // 56 //
57 // Measure creation of core isolate from a snapshot. 57 // Measure creation of core isolate from a snapshot.
58 // 58 //
59 BENCHMARK(CorelibIsolateStartup) { 59 BENCHMARK(CorelibIsolateStartup) {
60 const int kNumIterations = 100; 60 const int kNumIterations = 1000;
61 char* err = NULL; 61 Timer timer(true, "CorelibIsolateStartup");
62 Dart_Isolate base_isolate = Dart_CurrentIsolate(); 62 Isolate* isolate = Isolate::Current();
63 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL,
64 bin::snapshot_buffer,
65 NULL, &err);
66 EXPECT(test_isolate != NULL);
67 Dart_EnterScope();
68 uint8_t* buffer = NULL;
69 intptr_t size = 0;
70 Dart_Handle result = Dart_CreateSnapshot(&buffer, &size);
71 EXPECT_VALID(result);
72 Timer timer(true, "Core Isolate startup benchmark");
73 timer.Start();
74 for (int i = 0; i < kNumIterations; i++) { 63 for (int i = 0; i < kNumIterations; i++) {
75 Dart_Isolate new_isolate = 64 timer.Start();
76 Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err); 65 TestCase::CreateTestIsolate();
77 EXPECT(new_isolate != NULL); 66 timer.Stop();
78 Dart_ShutdownIsolate(); 67 Dart_ShutdownIsolate();
79 } 68 }
80 timer.Stop(); 69 benchmark->set_score(timer.TotalElapsedTime() / kNumIterations);
81 int64_t elapsed_time = timer.TotalElapsedTime(); 70 Isolate::SetCurrent(isolate);
82 benchmark->set_score(elapsed_time / kNumIterations);
83 Dart_EnterIsolate(test_isolate);
84 Dart_ExitScope();
85 Dart_ShutdownIsolate();
86 Dart_EnterIsolate(base_isolate);
87 } 71 }
88 72
89 73
90 // 74 //
91 // Measure invocation of Dart API functions. 75 // Measure invocation of Dart API functions.
92 // 76 //
93 static void InitNativeFields(Dart_NativeArguments args) { 77 static void InitNativeFields(Dart_NativeArguments args) {
94 Dart_EnterScope(); 78 Dart_EnterScope();
95 int count = Dart_GetNativeArgumentCount(args); 79 int count = Dart_GetNativeArgumentCount(args);
96 EXPECT_EQ(1, count); 80 EXPECT_EQ(1, count);
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate); 561 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, isolate);
578 reader.ReadObject(); 562 reader.ReadObject();
579 free(buffer); 563 free(buffer);
580 } 564 }
581 timer.Stop(); 565 timer.Stop();
582 int64_t elapsed_time = timer.TotalElapsedTime(); 566 int64_t elapsed_time = timer.TotalElapsedTime();
583 benchmark->set_score(elapsed_time); 567 benchmark->set_score(elapsed_time);
584 } 568 }
585 569
586 } // namespace dart 570 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698