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

Unified Diff: runtime/vm/benchmark_test.cc

Issue 1352483002: Add benchmark output to compiler stats. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: mmmmmmerge Created 5 years, 3 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 | « no previous file | runtime/vm/compiler_stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/benchmark_test.cc
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index 36dfae27797d72ec5a02f76271019f3f8ce867b7..900a689a3d8152610165f4eb8fb6b27265a35b0f 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -10,6 +10,7 @@
#include "platform/assert.h"
#include "platform/globals.h"
+#include "vm/compiler_stats.h"
#include "vm/dart_api_impl.h"
#include "vm/stack_frame.h"
#include "vm/unit_test.h"
@@ -46,7 +47,26 @@ BENCHMARK(CorelibCompileAll) {
OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
error.ToErrorCString());
}
- EXPECT(error.IsNull());
+ timer.Stop();
+ int64_t elapsed_time = timer.TotalElapsedTime();
+ benchmark->set_score(elapsed_time);
+}
+
+
+BENCHMARK(CorelibCompilerStats) {
+ bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
+ bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
+ CompilerStats* stats = Isolate::Current()->compiler_stats();
+ ASSERT(stats != NULL);
+ stats->EnableBenchmark();
+ Timer timer(true, "Compiler stats compiling all of Core lib");
+ timer.Start();
+ const Error& error = Error::Handle(benchmark->isolate(),
+ Library::CompileAll());
+ if (!error.IsNull()) {
+ OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
+ error.ToErrorCString());
+ }
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
benchmark->set_score(elapsed_time);
@@ -378,6 +398,41 @@ BENCHMARK(Dart2JSCompileAll) {
}
+BENCHMARK(Dart2JSCompilerStats) {
+ bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
+ bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
+ SetupDart2JSPackagePath();
+ char* dart_root = ComputeDart2JSPath(Benchmark::Executable());
+ char* script = NULL;
+ if (dart_root != NULL) {
+ HANDLESCOPE(thread);
+ script = OS::SCreate(NULL,
+ "import '%s/pkg/compiler/lib/compiler.dart';", dart_root);
+ Dart_Handle lib = TestCase::LoadTestScript(
+ script,
+ reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
+ EXPECT_VALID(lib);
+ } else {
+ Dart_Handle lib = TestCase::LoadTestScript(
+ "import 'pkg/compiler/lib/compiler.dart';",
+ reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
+ EXPECT_VALID(lib);
+ }
+ CompilerStats* stats = Isolate::Current()->compiler_stats();
+ ASSERT(stats != NULL);
+ stats->EnableBenchmark();
+ Timer timer(true, "Compile all of dart2js benchmark");
+ timer.Start();
+ Dart_Handle result = Dart_CompileAll();
+ EXPECT_VALID(result);
+ timer.Stop();
+ int64_t elapsed_time = timer.TotalElapsedTime();
+ benchmark->set_score(elapsed_time);
+ free(dart_root);
+ free(script);
+}
+
+
//
// Measure frame lookup during stack traversal.
//
« no previous file with comments | « no previous file | runtime/vm/compiler_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698