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