| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/compiler_stats.h" | 5 #include "vm/compiler_stats.h" |
| 6 | 6 |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/timer.h" | 8 #include "vm/timer.h" |
| 9 | 9 |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 intptr_t CompilerStats::num_tokens_consumed = 0; | 59 intptr_t CompilerStats::num_tokens_consumed = 0; |
| 60 intptr_t CompilerStats::num_token_checks = 0; | 60 intptr_t CompilerStats::num_token_checks = 0; |
| 61 intptr_t CompilerStats::num_tokens_rewind = 0; | 61 intptr_t CompilerStats::num_tokens_rewind = 0; |
| 62 intptr_t CompilerStats::num_tokens_lookahead = 0; | 62 intptr_t CompilerStats::num_tokens_lookahead = 0; |
| 63 | 63 |
| 64 intptr_t CompilerStats::num_lib_cache_hit = 0; | 64 intptr_t CompilerStats::num_lib_cache_hit = 0; |
| 65 intptr_t CompilerStats::num_names_cached = 0; | 65 intptr_t CompilerStats::num_names_cached = 0; |
| 66 intptr_t CompilerStats::make_accessor_name = 0; | 66 intptr_t CompilerStats::make_accessor_name = 0; |
| 67 intptr_t CompilerStats::make_field_name = 0; | 67 intptr_t CompilerStats::make_field_name = 0; |
| 68 | 68 |
| 69 intptr_t CompilerStats::num_classes_compiled = 0; |
| 70 intptr_t CompilerStats::num_functions_compiled = 0; |
| 71 |
| 72 intptr_t CompilerStats::num_implicit_final_getters = 0; |
| 73 intptr_t CompilerStats::num_static_initializer_funcs = 0; |
| 74 |
| 69 void CompilerStats::Print() { | 75 void CompilerStats::Print() { |
| 70 if (!FLAG_compiler_stats) { | 76 if (!FLAG_compiler_stats) { |
| 71 return; | 77 return; |
| 72 } | 78 } |
| 73 OS::Print("==== Compiler Stats ====\n"); | 79 OS::Print("==== Compiler Stats ====\n"); |
| 74 OS::Print("Number of tokens: %" Pd "\n", num_tokens_total); | 80 OS::Print("Number of tokens: %" Pd "\n", num_tokens_total); |
| 75 OS::Print(" Literal tokens: %" Pd "\n", num_literal_tokens_total); | 81 OS::Print(" Literal tokens: %" Pd "\n", num_literal_tokens_total); |
| 76 OS::Print(" Ident tokens: %" Pd "\n", num_ident_tokens_total); | 82 OS::Print(" Ident tokens: %" Pd "\n", num_ident_tokens_total); |
| 77 OS::Print("Tokens consumed: %" Pd " (%.2f times number of tokens)\n", | 83 OS::Print("Tokens consumed: %" Pd " (%.2f times number of tokens)\n", |
| 78 num_tokens_consumed, | 84 num_tokens_consumed, |
| 79 (1.0 * num_tokens_consumed) / num_tokens_total); | 85 (1.0 * num_tokens_consumed) / num_tokens_total); |
| 80 OS::Print("Tokens checked: %" Pd " (%.2f times tokens consumed)\n", | 86 OS::Print("Tokens checked: %" Pd " (%.2f times tokens consumed)\n", |
| 81 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); | 87 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); |
| 82 OS::Print("Token rewind: %" Pd " (%" Pd "%% of tokens checked)\n", | 88 OS::Print("Token rewind: %" Pd " (%" Pd "%% of tokens checked)\n", |
| 83 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); | 89 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); |
| 84 OS::Print("Token lookahead: %" Pd " (%" Pd "%% of tokens checked)\n", | 90 OS::Print("Token lookahead: %" Pd " (%" Pd "%% of tokens checked)\n", |
| 85 num_tokens_lookahead, | 91 num_tokens_lookahead, |
| 86 (100 * num_tokens_lookahead) / num_token_checks); | 92 (100 * num_tokens_lookahead) / num_token_checks); |
| 87 | 93 |
| 94 OS::Print("Classes parsed: %" Pd "\n", num_classes_compiled); |
| 95 OS::Print("Functions compiled: %" Pd "\n", num_functions_compiled); |
| 96 OS::Print(" Impl getters: %" Pd "\n", num_implicit_final_getters); |
| 97 OS::Print(" Init funcs: %" Pd "\n", num_static_initializer_funcs); |
| 98 |
| 88 OS::Print("Lib names cached: %" Pd "\n", num_names_cached); | 99 OS::Print("Lib names cached: %" Pd "\n", num_names_cached); |
| 89 OS::Print("Lib name cache hit: %" Pd "\n", num_lib_cache_hit); | 100 OS::Print("Lib name cache hit: %" Pd "\n", num_lib_cache_hit); |
| 90 OS::Print("Accessor mangling: %" Pd " field->acc %" Pd " acc->field\n", | 101 OS::Print("Accessor mangling: %" Pd " field->acc %" Pd " acc->field\n", |
| 91 make_accessor_name, make_field_name); | 102 make_accessor_name, make_field_name); |
| 92 | 103 |
| 93 OS::Print("Source length: %" Pd " characters\n", src_length); | 104 OS::Print("Source length: %" Pd " characters\n", src_length); |
| 94 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); | 105 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); |
| 95 OS::Print("Scanner time: %" Pd64 " msecs\n", | 106 OS::Print("Scanner time: %" Pd64 " msecs\n", |
| 96 scan_usecs / 1000); | 107 scan_usecs / 1000); |
| 97 int64_t parse_usecs = parser_timer.TotalElapsedTime(); | 108 int64_t parse_usecs = parser_timer.TotalElapsedTime(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 codefinalizer_usecs / 1000); | 148 codefinalizer_usecs / 1000); |
| 138 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n", | 149 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n", |
| 139 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); | 150 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); |
| 140 OS::Print("Code size: %" Pd " KB\n", | 151 OS::Print("Code size: %" Pd " KB\n", |
| 141 code_allocated / 1024); | 152 code_allocated / 1024); |
| 142 OS::Print("Code density: %" Pd " tokens per KB\n", | 153 OS::Print("Code density: %" Pd " tokens per KB\n", |
| 143 num_tokens_total * 1024 / code_allocated); | 154 num_tokens_total * 1024 / code_allocated); |
| 144 } | 155 } |
| 145 | 156 |
| 146 } // namespace dart | 157 } // namespace dart |
| OLD | NEW |