Chromium Code Reviews| Index: runtime/vm/benchmark_test.cc |
| diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc |
| index 36dfae27797d72ec5a02f76271019f3f8ce867b7..f2aa1c256b77fe0b581b0b523b914f85e1628acf 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" |
| @@ -53,6 +54,27 @@ BENCHMARK(CorelibCompileAll) { |
| } |
| +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()); |
| + } |
| + EXPECT(error.IsNull()); |
|
siva
2015/09/16 17:25:00
The 'EXPECT(error.IsNull())' line seems to make th
hausner
2015/09/16 18:21:01
Done, also in the the code above.
|
| + timer.Stop(); |
| + int64_t elapsed_time = timer.TotalElapsedTime(); |
| + benchmark->set_score(elapsed_time); |
| +} |
| + |
| + |
| // |
| // Measure creation of core isolate from a snapshot. |
| // |
| @@ -378,6 +400,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. |
| // |