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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 | 55 |
56 intptr_t CompilerStats::num_tokens_total = 0; | 56 intptr_t CompilerStats::num_tokens_total = 0; |
57 intptr_t CompilerStats::num_literal_tokens_total = 0; | 57 intptr_t CompilerStats::num_literal_tokens_total = 0; |
58 intptr_t CompilerStats::num_ident_tokens_total = 0; | 58 intptr_t CompilerStats::num_ident_tokens_total = 0; |
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; |
| 65 intptr_t CompilerStats::num_names_cached = 0; |
| 66 intptr_t CompilerStats::make_accessor_name = 0; |
| 67 intptr_t CompilerStats::make_field_name = 0; |
| 68 |
64 void CompilerStats::Print() { | 69 void CompilerStats::Print() { |
65 if (!FLAG_compiler_stats) { | 70 if (!FLAG_compiler_stats) { |
66 return; | 71 return; |
67 } | 72 } |
68 OS::Print("==== Compiler Stats ====\n"); | 73 OS::Print("==== Compiler Stats ====\n"); |
69 OS::Print("Number of tokens: %" Pd "\n", num_tokens_total); | 74 OS::Print("Number of tokens: %" Pd "\n", num_tokens_total); |
70 OS::Print(" Literal tokens: %" Pd "\n", num_literal_tokens_total); | 75 OS::Print(" Literal tokens: %" Pd "\n", num_literal_tokens_total); |
71 OS::Print(" Ident tokens: %" Pd "\n", num_ident_tokens_total); | 76 OS::Print(" Ident tokens: %" Pd "\n", num_ident_tokens_total); |
72 OS::Print("Tokens consumed: %" Pd " (%.2f times number of tokens)\n", | 77 OS::Print("Tokens consumed: %" Pd " (%.2f times number of tokens)\n", |
73 num_tokens_consumed, | 78 num_tokens_consumed, |
74 (1.0 * num_tokens_consumed) / num_tokens_total); | 79 (1.0 * num_tokens_consumed) / num_tokens_total); |
75 OS::Print("Tokens checked: %" Pd " (%.2f times tokens consumed)\n", | 80 OS::Print("Tokens checked: %" Pd " (%.2f times tokens consumed)\n", |
76 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); | 81 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); |
77 OS::Print("Token rewind: %" Pd " (%" Pd "%% of tokens checked)\n", | 82 OS::Print("Token rewind: %" Pd " (%" Pd "%% of tokens checked)\n", |
78 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); | 83 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); |
79 OS::Print("Token lookahead: %" Pd " (%" Pd "%% of tokens checked)\n", | 84 OS::Print("Token lookahead: %" Pd " (%" Pd "%% of tokens checked)\n", |
80 num_tokens_lookahead, | 85 num_tokens_lookahead, |
81 (100 * num_tokens_lookahead) / num_token_checks); | 86 (100 * num_tokens_lookahead) / num_token_checks); |
| 87 |
| 88 OS::Print("Lib names cached: %" Pd "\n", num_names_cached); |
| 89 OS::Print("Lib name cache hit: %" Pd "\n", num_lib_cache_hit); |
| 90 OS::Print("Accessor mangling: %" Pd " field->acc %" Pd " acc->field\n", |
| 91 make_accessor_name, make_field_name); |
| 92 |
82 OS::Print("Source length: %" Pd " characters\n", src_length); | 93 OS::Print("Source length: %" Pd " characters\n", src_length); |
83 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); | 94 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); |
84 OS::Print("Scanner time: %" Pd64 " msecs\n", | 95 OS::Print("Scanner time: %" Pd64 " msecs\n", |
85 scan_usecs / 1000); | 96 scan_usecs / 1000); |
86 int64_t parse_usecs = parser_timer.TotalElapsedTime(); | 97 int64_t parse_usecs = parser_timer.TotalElapsedTime(); |
87 OS::Print("Parser time: %" Pd64 " msecs\n", | 98 OS::Print("Parser time: %" Pd64 " msecs\n", |
88 parse_usecs / 1000); | 99 parse_usecs / 1000); |
89 int64_t codegen_usecs = codegen_timer.TotalElapsedTime(); | 100 int64_t codegen_usecs = codegen_timer.TotalElapsedTime(); |
90 OS::Print("Code gen. time: %" Pd64 " msecs\n", | 101 OS::Print("Code gen. time: %" Pd64 " msecs\n", |
91 codegen_usecs / 1000); | 102 codegen_usecs / 1000); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 codefinalizer_usecs / 1000); | 137 codefinalizer_usecs / 1000); |
127 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n", | 138 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n", |
128 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); | 139 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); |
129 OS::Print("Code size: %" Pd " KB\n", | 140 OS::Print("Code size: %" Pd " KB\n", |
130 code_allocated / 1024); | 141 code_allocated / 1024); |
131 OS::Print("Code density: %" Pd " tokens per KB\n", | 142 OS::Print("Code density: %" Pd " tokens per KB\n", |
132 num_tokens_total * 1024 / code_allocated); | 143 num_tokens_total * 1024 / code_allocated); |
133 } | 144 } |
134 | 145 |
135 } // namespace dart | 146 } // namespace dart |
OLD | NEW |