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

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

Issue 10407042: spawnUri. Take two. This time I'll wait for Anton before committing :-). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « runtime/vm/benchmark_test.h ('k') | runtime/vm/bootstrap_natives.h » ('j') | 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/file.h" 7 #include "bin/file.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 49 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64
50 50
51 51
52 // 52 //
53 // Measure creation of core isolate from a snapshot. 53 // Measure creation of core isolate from a snapshot.
54 // 54 //
55 BENCHMARK(CorelibIsolateStartup) { 55 BENCHMARK(CorelibIsolateStartup) {
56 const int kNumIterations = 100; 56 const int kNumIterations = 100;
57 char* err = NULL; 57 char* err = NULL;
58 Dart_Isolate base_isolate = Dart_CurrentIsolate(); 58 Dart_Isolate base_isolate = Dart_CurrentIsolate();
59 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, &err); 59 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &err);
60 EXPECT(test_isolate != NULL); 60 EXPECT(test_isolate != NULL);
61 Dart_EnterScope(); 61 Dart_EnterScope();
62 uint8_t* buffer = NULL; 62 uint8_t* buffer = NULL;
63 intptr_t size = 0; 63 intptr_t size = 0;
64 Dart_Handle result = Dart_CreateSnapshot(&buffer, &size); 64 Dart_Handle result = Dart_CreateSnapshot(&buffer, &size);
65 EXPECT(!Dart_IsError(result)); 65 EXPECT(!Dart_IsError(result));
66 Timer timer(true, "Core Isolate startup benchmark"); 66 Timer timer(true, "Core Isolate startup benchmark");
67 timer.Start(); 67 timer.Start();
68 for (int i = 0; i < kNumIterations; i++) { 68 for (int i = 0; i < kNumIterations; i++) {
69 Dart_Isolate new_isolate = Dart_CreateIsolate(NULL, buffer, NULL, &err); 69 Dart_Isolate new_isolate =
70 Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err);
70 EXPECT(new_isolate != NULL); 71 EXPECT(new_isolate != NULL);
71 Dart_ShutdownIsolate(); 72 Dart_ShutdownIsolate();
72 } 73 }
73 timer.Stop(); 74 timer.Stop();
74 int64_t elapsed_time = timer.TotalElapsedTime(); 75 int64_t elapsed_time = timer.TotalElapsedTime();
75 benchmark->set_score(elapsed_time / kNumIterations); 76 benchmark->set_score(elapsed_time / kNumIterations);
76 Dart_EnterIsolate(test_isolate); 77 Dart_EnterIsolate(test_isolate);
77 Dart_ExitScope(); 78 Dart_ExitScope();
78 Dart_ShutdownIsolate(); 79 Dart_ShutdownIsolate();
79 Dart_EnterIsolate(base_isolate); 80 Dart_EnterIsolate(base_isolate);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver)); 336 reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver));
336 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest")); 337 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest"));
337 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL); 338 Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
338 EXPECT_VALID(result); 339 EXPECT_VALID(result);
339 int64_t elapsed_time = 0; 340 int64_t elapsed_time = 0;
340 EXPECT(!Dart_IsError(Dart_IntegerToInt64(result, &elapsed_time))); 341 EXPECT(!Dart_IsError(Dart_IntegerToInt64(result, &elapsed_time)));
341 benchmark->set_score(elapsed_time); 342 benchmark->set_score(elapsed_time);
342 } 343 }
343 344
344 } // namespace dart 345 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/benchmark_test.h ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698