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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/benchmark_test.h ('k') | vm/vm_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/benchmark_test.cc
===================================================================
--- vm/benchmark_test.cc (revision 0)
+++ vm/benchmark_test.cc (revision 0)
@@ -0,0 +1,66 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/benchmark_test.h"
+#include "vm/dart_api_impl.h"
+
+namespace dart {
+
+Benchmark* Benchmark::first_ = NULL;
+Benchmark* Benchmark::tail_ = NULL;
+
+void Benchmark::RunAll() {
+ Benchmark* benchmark = first_;
+ while (benchmark != NULL) {
+ benchmark->RunBenchmark();
+ benchmark = benchmark->next_;
+ }
+}
+
+
+// Compiler only implemented on IA32 and X64 now.
+#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
+
+BENCHMARK(CorelibCompileAll) {
+ Timer timer(true, "Compile all benchmark");
+ timer.Start();
+ const Error& error = Error::Handle(benchmark->isolate(),
+ Library::CompileAll());
+ EXPECT(error.IsNull());
+ timer.Stop();
+ int64_t elapsed_time = timer.TotalElapsedTime();
+ benchmark->set_score(elapsed_time);
+}
+
+#endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64
+
+
+BENCHMARK(CorelibIsolateStartup) {
+ const int kNumIterations = 100;
+ char* err;
srdjan 2012/04/20 23:13:55 initialize to NULL?
siva 2012/04/30 16:38:04 Done.
+ Dart_Isolate base_isolate = Dart_CurrentIsolate();
+ Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, &err);
+ EXPECT(test_isolate != NULL);
+ Dart_EnterScope();
+ uint8_t* buffer = NULL;
+ intptr_t size = 0;
+ Dart_Handle result = Dart_CreateSnapshot(&buffer, &size);
+ EXPECT(!Dart_IsError(result));
+ Timer timer(true, "Core Isolate startup benchmark");
+ timer.Start();
+ for (int i = 0; i < kNumIterations; i++) {
+ Dart_Isolate new_isolate = Dart_CreateIsolate(NULL, buffer, NULL, &err);
+ EXPECT(new_isolate != NULL);
+ Dart_ShutdownIsolate();
+ }
+ timer.Stop();
+ Dart_EnterIsolate(test_isolate);
+ Dart_ExitScope();
+ Dart_ShutdownIsolate();
+ Dart_EnterIsolate(base_isolate);
+ int64_t elapsed_time = timer.TotalElapsedTime();
+ benchmark->set_score(elapsed_time / kNumIterations);
+}
+
+} // namespace dart
« 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