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

Side by Side Diff: vm/benchmark_test.cc

Issue 10069039: Add infrastructure to create and run benchmarks specific to some VM functionality. This is used to … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | « vm/benchmark_test.h ('k') | vm/vm_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "vm/benchmark_test.h"
6 #include "vm/dart_api_impl.h"
7
8 namespace dart {
9
10 Benchmark* Benchmark::first_ = NULL;
11 Benchmark* Benchmark::tail_ = NULL;
12
13 void Benchmark::RunAll() {
14 Benchmark* benchmark = first_;
15 while (benchmark != NULL) {
16 benchmark->RunBenchmark();
17 benchmark = benchmark->next_;
18 }
19 }
20
21
22 // Compiler only implemented on IA32 and X64 now.
23 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
24
25 BENCHMARK(CorelibCompileAll) {
26 Timer timer(true, "Compile all benchmark");
27 timer.Start();
28 const Error& error = Error::Handle(benchmark->isolate(),
29 Library::CompileAll());
30 EXPECT(error.IsNull());
31 timer.Stop();
32 int64_t elapsed_time = timer.TotalElapsedTime();
33 benchmark->set_score(elapsed_time);
34 }
35
36 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64
37
38
39 BENCHMARK(CorelibIsolateStartup) {
40 const int kNumIterations = 100;
41 char* err;
srdjan 2012/04/20 23:13:55 initialize to NULL?
siva 2012/04/30 16:38:04 Done.
42 Dart_Isolate base_isolate = Dart_CurrentIsolate();
43 Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, &err);
44 EXPECT(test_isolate != NULL);
45 Dart_EnterScope();
46 uint8_t* buffer = NULL;
47 intptr_t size = 0;
48 Dart_Handle result = Dart_CreateSnapshot(&buffer, &size);
49 EXPECT(!Dart_IsError(result));
50 Timer timer(true, "Core Isolate startup benchmark");
51 timer.Start();
52 for (int i = 0; i < kNumIterations; i++) {
53 Dart_Isolate new_isolate = Dart_CreateIsolate(NULL, buffer, NULL, &err);
54 EXPECT(new_isolate != NULL);
55 Dart_ShutdownIsolate();
56 }
57 timer.Stop();
58 Dart_EnterIsolate(test_isolate);
59 Dart_ExitScope();
60 Dart_ShutdownIsolate();
61 Dart_EnterIsolate(base_isolate);
62 int64_t elapsed_time = timer.TotalElapsedTime();
63 benchmark->set_score(elapsed_time / kNumIterations);
64 }
65
66 } // namespace dart
OLDNEW
« no previous file with comments | « vm/benchmark_test.h ('k') | vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698