| 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/log.h" | 8 #include "vm/log.h" |
| 9 #include "vm/object_graph.h" | 9 #include "vm/object_graph.h" |
| 10 #include "vm/object_store.h" |
| 10 #include "vm/timer.h" | 11 #include "vm/timer.h" |
| 11 | 12 |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters."); | 16 DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters."); |
| 16 DEFINE_FLAG(bool, compiler_benchmark, false, | 17 DEFINE_FLAG(bool, compiler_benchmark, false, |
| 17 "Compiler stat counters for benchmark."); | 18 "Compiler stat counters for benchmark."); |
| 18 | 19 |
| 19 | 20 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 187 |
| 187 Log log(PrintToStats); | 188 Log log(PrintToStats); |
| 188 LogBlock lb(Thread::Current(), &log); | 189 LogBlock lb(Thread::Current(), &log); |
| 189 | 190 |
| 190 log.Print("==== Compiler Stats for isolate '%s' ====\n", | 191 log.Print("==== Compiler Stats for isolate '%s' ====\n", |
| 191 isolate_->debugger_name()); | 192 isolate_->debugger_name()); |
| 192 log.Print("Number of tokens: %" Pd64 "\n", num_tokens_total); | 193 log.Print("Number of tokens: %" Pd64 "\n", num_tokens_total); |
| 193 log.Print("Source length: %" Pd64 " characters\n", src_length); | 194 log.Print("Source length: %" Pd64 " characters\n", src_length); |
| 194 log.Print("Number of source tokens: %" Pd64 "\n", num_tokens_scanned); | 195 log.Print("Number of source tokens: %" Pd64 "\n", num_tokens_scanned); |
| 195 | 196 |
| 197 int64_t num_local_functions = GrowableObjectArray::Handle( |
| 198 isolate_->object_store()->closure_functions()).Length(); |
| 199 |
| 196 log.Print("==== Parser stats:\n"); | 200 log.Print("==== Parser stats:\n"); |
| 197 log.Print("Total tokens consumed: %" Pd64 "\n", num_tokens_consumed); | 201 log.Print("Total tokens consumed: %" Pd64 "\n", num_tokens_consumed); |
| 198 log.Print("Classes parsed: %" Pd64 "\n", num_classes_parsed); | 202 log.Print("Classes parsed: %" Pd64 "\n", num_classes_parsed); |
| 199 log.Print(" Tokens consumed: %" Pd64 "\n", num_class_tokens); | 203 log.Print(" Tokens consumed: %" Pd64 "\n", num_class_tokens); |
| 200 log.Print("Functions parsed: %" Pd64 "\n", num_functions_parsed); | 204 log.Print("Functions parsed: %" Pd64 "\n", num_functions_parsed); |
| 201 log.Print(" Tokens consumed: %" Pd64 "\n", num_func_tokens_compiled); | 205 log.Print(" Tokens consumed: %" Pd64 "\n", num_func_tokens_compiled); |
| 202 log.Print("Impl getter funcs: %" Pd64 "\n", num_implicit_final_getters); | 206 log.Print("Impl getter funcs: %" Pd64 "\n", num_implicit_final_getters); |
| 203 log.Print("Impl method extractors: %" Pd64 "\n", num_method_extractors); | 207 log.Print("Impl method extractors: %" Pd64 "\n", num_method_extractors); |
| 208 log.Print("Local functions: %" Pd64 "\n", num_local_functions); |
| 204 log.Print("Consts cached: %" Pd64 "\n", num_cached_consts); | 209 log.Print("Consts cached: %" Pd64 "\n", num_cached_consts); |
| 205 log.Print("Consts cache hits: %" Pd64 "\n", num_const_cache_hits); | 210 log.Print("Consts cache hits: %" Pd64 "\n", num_const_cache_hits); |
| 206 | 211 |
| 207 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); | 212 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); |
| 208 log.Print("Scanner time: %" Pd64 " ms\n", scan_usecs / 1000); | 213 log.Print("Scanner time: %" Pd64 " ms\n", scan_usecs / 1000); |
| 209 int64_t scan_speed = | 214 int64_t scan_speed = |
| 210 scan_usecs > 0 ? 1000 * num_tokens_consumed / scan_usecs : 0; | 215 scan_usecs > 0 ? 1000 * num_tokens_consumed / scan_usecs : 0; |
| 211 log.Print("Scanner speed: %" Pd64 " tokens/ms\n", scan_speed); | 216 log.Print("Scanner speed: %" Pd64 " tokens/ms\n", scan_speed); |
| 212 int64_t parse_usecs = parser_timer.TotalElapsedTime(); | 217 int64_t parse_usecs = parser_timer.TotalElapsedTime(); |
| 213 int64_t parse_speed = | 218 int64_t parse_speed = |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 total_instr_size / 1024); | 280 total_instr_size / 1024); |
| 276 log.Print(" Pc Desc size: %" Pd64 " KB\n", pc_desc_size / 1024); | 281 log.Print(" Pc Desc size: %" Pd64 " KB\n", pc_desc_size / 1024); |
| 277 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); | 282 log.Print(" VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024); |
| 278 log.Flush(); | 283 log.Flush(); |
| 279 char* stats_text = text; | 284 char* stats_text = text; |
| 280 text = NULL; | 285 text = NULL; |
| 281 return stats_text; | 286 return stats_text; |
| 282 } | 287 } |
| 283 | 288 |
| 284 } // namespace dart | 289 } // namespace dart |
| OLD | NEW |