| OLD | NEW |
| 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/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 if (!error.IsNull()) { | 46 if (!error.IsNull()) { |
| 47 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", | 47 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", |
| 48 error.ToErrorCString()); | 48 error.ToErrorCString()); |
| 49 } | 49 } |
| 50 timer.Stop(); | 50 timer.Stop(); |
| 51 int64_t elapsed_time = timer.TotalElapsedTime(); | 51 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 52 benchmark->set_score(elapsed_time); | 52 benchmark->set_score(elapsed_time); |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 #if 0 | |
| 57 BENCHMARK(CorelibCompilerStats) { | 56 BENCHMARK(CorelibCompilerStats) { |
| 58 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 57 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
| 59 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); | 58 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); |
| 60 CompilerStats* stats = Isolate::Current()->compiler_stats(); | 59 CompilerStats* stats = Isolate::Current()->compiler_stats(); |
| 61 ASSERT(stats != NULL); | 60 ASSERT(stats != NULL); |
| 62 stats->EnableBenchmark(); | 61 stats->EnableBenchmark(); |
| 63 Timer timer(true, "Compiler stats compiling all of Core lib"); | 62 Timer timer(true, "Compiler stats compiling all of Core lib"); |
| 64 timer.Start(); | 63 timer.Start(); |
| 65 const Error& error = Error::Handle(benchmark->isolate(), | 64 const Error& error = Error::Handle(benchmark->isolate(), |
| 66 Library::CompileAll()); | 65 Library::CompileAll()); |
| 67 if (!error.IsNull()) { | 66 if (!error.IsNull()) { |
| 68 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", | 67 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", |
| 69 error.ToErrorCString()); | 68 error.ToErrorCString()); |
| 70 } | 69 } |
| 71 timer.Stop(); | 70 timer.Stop(); |
| 72 int64_t elapsed_time = timer.TotalElapsedTime(); | 71 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 73 benchmark->set_score(elapsed_time); | 72 benchmark->set_score(elapsed_time); |
| 74 } | 73 } |
| 75 #endif | |
| 76 | 74 |
| 77 | 75 |
| 78 // | 76 // |
| 79 // Measure creation of core isolate from a snapshot. | 77 // Measure creation of core isolate from a snapshot. |
| 80 // | 78 // |
| 81 BENCHMARK(CorelibIsolateStartup) { | 79 BENCHMARK(CorelibIsolateStartup) { |
| 82 const int kNumIterations = 1000; | 80 const int kNumIterations = 1000; |
| 83 Timer timer(true, "CorelibIsolateStartup"); | 81 Timer timer(true, "CorelibIsolateStartup"); |
| 84 Isolate* isolate = Isolate::Current(); | 82 Isolate* isolate = Isolate::Current(); |
| 85 Thread::ExitIsolate(); | 83 Thread::ExitIsolate(); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 Dart_Handle result = Dart_CompileAll(); | 391 Dart_Handle result = Dart_CompileAll(); |
| 394 EXPECT_VALID(result); | 392 EXPECT_VALID(result); |
| 395 timer.Stop(); | 393 timer.Stop(); |
| 396 int64_t elapsed_time = timer.TotalElapsedTime(); | 394 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 397 benchmark->set_score(elapsed_time); | 395 benchmark->set_score(elapsed_time); |
| 398 free(dart_root); | 396 free(dart_root); |
| 399 free(script); | 397 free(script); |
| 400 } | 398 } |
| 401 | 399 |
| 402 | 400 |
| 403 #if 0 | |
| 404 BENCHMARK(Dart2JSCompilerStats) { | 401 BENCHMARK(Dart2JSCompilerStats) { |
| 405 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 402 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
| 406 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); | 403 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); |
| 407 SetupDart2JSPackagePath(); | 404 SetupDart2JSPackagePath(); |
| 408 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); | 405 char* dart_root = ComputeDart2JSPath(Benchmark::Executable()); |
| 409 char* script = NULL; | 406 char* script = NULL; |
| 410 if (dart_root != NULL) { | 407 if (dart_root != NULL) { |
| 411 HANDLESCOPE(thread); | 408 HANDLESCOPE(thread); |
| 412 script = OS::SCreate(NULL, | 409 script = OS::SCreate(NULL, |
| 413 "import '%s/pkg/compiler/lib/compiler.dart';", dart_root); | 410 "import '%s/pkg/compiler/lib/compiler.dart';", dart_root); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 427 Timer timer(true, "Compile all of dart2js benchmark"); | 424 Timer timer(true, "Compile all of dart2js benchmark"); |
| 428 timer.Start(); | 425 timer.Start(); |
| 429 Dart_Handle result = Dart_CompileAll(); | 426 Dart_Handle result = Dart_CompileAll(); |
| 430 EXPECT_VALID(result); | 427 EXPECT_VALID(result); |
| 431 timer.Stop(); | 428 timer.Stop(); |
| 432 int64_t elapsed_time = timer.TotalElapsedTime(); | 429 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 433 benchmark->set_score(elapsed_time); | 430 benchmark->set_score(elapsed_time); |
| 434 free(dart_root); | 431 free(dart_root); |
| 435 free(script); | 432 free(script); |
| 436 } | 433 } |
| 437 #endif | |
| 438 | 434 |
| 439 | 435 |
| 440 // | 436 // |
| 441 // Measure frame lookup during stack traversal. | 437 // Measure frame lookup during stack traversal. |
| 442 // | 438 // |
| 443 static void StackFrame_accessFrame(Dart_NativeArguments args) { | 439 static void StackFrame_accessFrame(Dart_NativeArguments args) { |
| 444 const int kNumIterations = 100; | 440 const int kNumIterations = 100; |
| 445 Code& code = Code::Handle(); | 441 Code& code = Code::Handle(); |
| 446 Timer timer(true, "LookupDartCode benchmark"); | 442 Timer timer(true, "LookupDartCode benchmark"); |
| 447 timer.Start(); | 443 timer.Start(); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 thread); | 750 thread); |
| 755 reader.ReadObject(); | 751 reader.ReadObject(); |
| 756 free(buffer); | 752 free(buffer); |
| 757 } | 753 } |
| 758 timer.Stop(); | 754 timer.Stop(); |
| 759 int64_t elapsed_time = timer.TotalElapsedTime(); | 755 int64_t elapsed_time = timer.TotalElapsedTime(); |
| 760 benchmark->set_score(elapsed_time); | 756 benchmark->set_score(elapsed_time); |
| 761 } | 757 } |
| 762 | 758 |
| 763 } // namespace dart | 759 } // namespace dart |
| OLD | NEW |