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 void CompilerStats::Print() { | 64 void CompilerStats::Print() { |
65 if (!FLAG_compiler_stats) { | 65 if (!FLAG_compiler_stats) { |
66 return; | 66 return; |
67 } | 67 } |
68 OS::Print("==== Compiler Stats ====\n"); | 68 OS::Print("==== Compiler Stats ====\n"); |
69 OS::Print("Number of tokens: %"Pd"\n", num_tokens_total); | 69 OS::Print("Number of tokens: %" Pd "\n", num_tokens_total); |
70 OS::Print(" Literal tokens: %"Pd"\n", num_literal_tokens_total); | 70 OS::Print(" Literal tokens: %" Pd "\n", num_literal_tokens_total); |
71 OS::Print(" Ident tokens: %"Pd"\n", num_ident_tokens_total); | 71 OS::Print(" Ident tokens: %" Pd "\n", num_ident_tokens_total); |
72 OS::Print("Tokens consumed: %"Pd" (%.2f times number of tokens)\n", | 72 OS::Print("Tokens consumed: %" Pd " (%.2f times number of tokens)\n", |
73 num_tokens_consumed, | 73 num_tokens_consumed, |
74 (1.0 * num_tokens_consumed) / num_tokens_total); | 74 (1.0 * num_tokens_consumed) / num_tokens_total); |
75 OS::Print("Tokens checked: %"Pd" (%.2f times tokens consumed)\n", | 75 OS::Print("Tokens checked: %" Pd " (%.2f times tokens consumed)\n", |
76 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); | 76 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); |
77 OS::Print("Token rewind: %"Pd" (%"Pd"%% of tokens checked)\n", | 77 OS::Print("Token rewind: %" Pd " (%" Pd "%% of tokens checked)\n", |
78 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); | 78 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); |
79 OS::Print("Token lookahead: %"Pd" (%"Pd"%% of tokens checked)\n", | 79 OS::Print("Token lookahead: %" Pd " (%" Pd "%% of tokens checked)\n", |
80 num_tokens_lookahead, | 80 num_tokens_lookahead, |
81 (100 * num_tokens_lookahead) / num_token_checks); | 81 (100 * num_tokens_lookahead) / num_token_checks); |
82 OS::Print("Source length: %"Pd" characters\n", src_length); | 82 OS::Print("Source length: %" Pd " characters\n", src_length); |
83 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); | 83 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); |
84 OS::Print("Scanner time: %"Pd64" msecs\n", | 84 OS::Print("Scanner time: %" Pd64 " msecs\n", |
85 scan_usecs / 1000); | 85 scan_usecs / 1000); |
86 int64_t parse_usecs = parser_timer.TotalElapsedTime(); | 86 int64_t parse_usecs = parser_timer.TotalElapsedTime(); |
87 OS::Print("Parser time: %"Pd64" msecs\n", | 87 OS::Print("Parser time: %" Pd64 " msecs\n", |
88 parse_usecs / 1000); | 88 parse_usecs / 1000); |
89 int64_t codegen_usecs = codegen_timer.TotalElapsedTime(); | 89 int64_t codegen_usecs = codegen_timer.TotalElapsedTime(); |
90 OS::Print("Code gen. time: %"Pd64" msecs\n", | 90 OS::Print("Code gen. time: %" Pd64 " msecs\n", |
91 codegen_usecs / 1000); | 91 codegen_usecs / 1000); |
92 int64_t graphbuilder_usecs = graphbuilder_timer.TotalElapsedTime(); | 92 int64_t graphbuilder_usecs = graphbuilder_timer.TotalElapsedTime(); |
93 OS::Print(" Graph builder: %"Pd64" msecs\n", graphbuilder_usecs / 1000); | 93 OS::Print(" Graph builder: %" Pd64 " msecs\n", graphbuilder_usecs / 1000); |
94 int64_t ssa_usecs = ssa_timer.TotalElapsedTime(); | 94 int64_t ssa_usecs = ssa_timer.TotalElapsedTime(); |
95 OS::Print(" Graph SSA: %"Pd64" msecs\n", ssa_usecs / 1000); | 95 OS::Print(" Graph SSA: %" Pd64 " msecs\n", ssa_usecs / 1000); |
96 | 96 |
97 int64_t graphinliner_usecs = graphinliner_timer.TotalElapsedTime(); | 97 int64_t graphinliner_usecs = graphinliner_timer.TotalElapsedTime(); |
98 OS::Print(" Graph inliner: %"Pd64" msecs\n", graphinliner_usecs / 1000); | 98 OS::Print(" Graph inliner: %" Pd64 " msecs\n", graphinliner_usecs / 1000); |
99 int64_t graphinliner_parse_usecs = | 99 int64_t graphinliner_parse_usecs = |
100 graphinliner_parse_timer.TotalElapsedTime(); | 100 graphinliner_parse_timer.TotalElapsedTime(); |
101 OS::Print(" Parsing: %"Pd64" msecs\n", | 101 OS::Print(" Parsing: %" Pd64 " msecs\n", |
102 graphinliner_parse_usecs / 1000); | 102 graphinliner_parse_usecs / 1000); |
103 int64_t graphinliner_build_usecs = | 103 int64_t graphinliner_build_usecs = |
104 graphinliner_build_timer.TotalElapsedTime(); | 104 graphinliner_build_timer.TotalElapsedTime(); |
105 OS::Print(" Building: %"Pd64" msecs\n", | 105 OS::Print(" Building: %" Pd64 " msecs\n", |
106 graphinliner_build_usecs / 1000); | 106 graphinliner_build_usecs / 1000); |
107 int64_t graphinliner_ssa_usecs = graphinliner_ssa_timer.TotalElapsedTime(); | 107 int64_t graphinliner_ssa_usecs = graphinliner_ssa_timer.TotalElapsedTime(); |
108 OS::Print(" SSA: %"Pd64" msecs\n", | 108 OS::Print(" SSA: %" Pd64 " msecs\n", |
109 graphinliner_ssa_usecs / 1000); | 109 graphinliner_ssa_usecs / 1000); |
110 int64_t graphinliner_opt_usecs = graphinliner_opt_timer.TotalElapsedTime(); | 110 int64_t graphinliner_opt_usecs = graphinliner_opt_timer.TotalElapsedTime(); |
111 OS::Print(" Optimization: %"Pd64" msecs\n", | 111 OS::Print(" Optimization: %" Pd64 " msecs\n", |
112 graphinliner_opt_usecs / 1000); | 112 graphinliner_opt_usecs / 1000); |
113 int64_t graphinliner_subst_usecs = | 113 int64_t graphinliner_subst_usecs = |
114 graphinliner_subst_timer.TotalElapsedTime(); | 114 graphinliner_subst_timer.TotalElapsedTime(); |
115 OS::Print(" Substitution: %"Pd64" msecs\n", | 115 OS::Print(" Substitution: %" Pd64 " msecs\n", |
116 graphinliner_subst_usecs / 1000); | 116 graphinliner_subst_usecs / 1000); |
117 | 117 |
118 int64_t graphoptimizer_usecs = graphoptimizer_timer.TotalElapsedTime(); | 118 int64_t graphoptimizer_usecs = graphoptimizer_timer.TotalElapsedTime(); |
119 OS::Print(" Graph optimizer: %"Pd64" msecs\n", | 119 OS::Print(" Graph optimizer: %" Pd64 " msecs\n", |
120 (graphoptimizer_usecs - graphinliner_usecs) / 1000); | 120 (graphoptimizer_usecs - graphinliner_usecs) / 1000); |
121 int64_t graphcompiler_usecs = graphcompiler_timer.TotalElapsedTime(); | 121 int64_t graphcompiler_usecs = graphcompiler_timer.TotalElapsedTime(); |
122 OS::Print(" Graph compiler: %"Pd64" msecs\n", | 122 OS::Print(" Graph compiler: %" Pd64 " msecs\n", |
123 graphcompiler_usecs / 1000); | 123 graphcompiler_usecs / 1000); |
124 int64_t codefinalizer_usecs = codefinalizer_timer.TotalElapsedTime(); | 124 int64_t codefinalizer_usecs = codefinalizer_timer.TotalElapsedTime(); |
125 OS::Print(" Code finalizer: %"Pd64" msecs\n", | 125 OS::Print(" Code finalizer: %" Pd64 " msecs\n", |
126 codefinalizer_usecs / 1000); | 126 codefinalizer_usecs / 1000); |
127 OS::Print("Compilation speed: %"Pd64" tokens per msec\n", | 127 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n", |
128 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); | 128 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); |
129 OS::Print("Code size: %"Pd" KB\n", | 129 OS::Print("Code size: %" Pd " KB\n", |
130 code_allocated / 1024); | 130 code_allocated / 1024); |
131 OS::Print("Code density: %"Pd" tokens per KB\n", | 131 OS::Print("Code density: %" Pd " tokens per KB\n", |
132 num_tokens_total * 1024 / code_allocated); | 132 num_tokens_total * 1024 / code_allocated); |
133 } | 133 } |
134 | 134 |
135 } // namespace dart | 135 } // namespace dart |
OLD | NEW |