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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 | 35 |
36 // | 36 // |
37 // Measure compile of all functions in dart core lib classes. | 37 // Measure compile of all functions in dart core lib classes. |
38 // | 38 // |
39 BENCHMARK(CorelibCompileAll) { | 39 BENCHMARK(CorelibCompileAll) { |
40 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 40 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
41 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); | 41 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); |
42 Timer timer(true, "Compile all of Core lib benchmark"); | 42 Timer timer(true, "Compile all of Core lib benchmark"); |
43 timer.Start(); | 43 timer.Start(); |
44 const Error& error = Error::Handle(benchmark->isolate()->current_zone(), | 44 const Error& error = Error::Handle(Library::CompileAll()); |
45 Library::CompileAll()); | |
46 if (!error.IsNull()) { | 45 if (!error.IsNull()) { |
47 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", | 46 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", |
48 error.ToErrorCString()); | 47 error.ToErrorCString()); |
49 } | 48 } |
50 timer.Stop(); | 49 timer.Stop(); |
51 int64_t elapsed_time = timer.TotalElapsedTime(); | 50 int64_t elapsed_time = timer.TotalElapsedTime(); |
52 benchmark->set_score(elapsed_time); | 51 benchmark->set_score(elapsed_time); |
53 } | 52 } |
54 | 53 |
55 | 54 |
56 BENCHMARK(CorelibCompilerStats) { | 55 BENCHMARK(CorelibCompilerStats) { |
57 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); | 56 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary); |
58 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); | 57 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary); |
59 CompilerStats* stats = Isolate::Current()->compiler_stats(); | 58 CompilerStats* stats = Isolate::Current()->compiler_stats(); |
60 ASSERT(stats != NULL); | 59 ASSERT(stats != NULL); |
61 stats->EnableBenchmark(); | 60 stats->EnableBenchmark(); |
62 Timer timer(true, "Compiler stats compiling all of Core lib"); | 61 Timer timer(true, "Compiler stats compiling all of Core lib"); |
63 timer.Start(); | 62 timer.Start(); |
64 const Error& error = Error::Handle(benchmark->isolate()->current_zone(), | 63 const Error& error = Error::Handle(Library::CompileAll()); |
65 Library::CompileAll()); | |
66 if (!error.IsNull()) { | 64 if (!error.IsNull()) { |
67 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", | 65 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s", |
68 error.ToErrorCString()); | 66 error.ToErrorCString()); |
69 } | 67 } |
70 timer.Stop(); | 68 timer.Stop(); |
71 int64_t elapsed_time = timer.TotalElapsedTime(); | 69 int64_t elapsed_time = timer.TotalElapsedTime(); |
72 benchmark->set_score(elapsed_time); | 70 benchmark->set_score(elapsed_time); |
73 } | 71 } |
74 | 72 |
75 | 73 |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 thread); | 748 thread); |
751 reader.ReadObject(); | 749 reader.ReadObject(); |
752 free(buffer); | 750 free(buffer); |
753 } | 751 } |
754 timer.Stop(); | 752 timer.Stop(); |
755 int64_t elapsed_time = timer.TotalElapsedTime(); | 753 int64_t elapsed_time = timer.TotalElapsedTime(); |
756 benchmark->set_score(elapsed_time); | 754 benchmark->set_score(elapsed_time); |
757 } | 755 } |
758 | 756 |
759 } // namespace dart | 757 } // namespace dart |
OLD | NEW |