| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 intptr_t CompilerStats::num_tokens_consumed = 0; | 43 intptr_t CompilerStats::num_tokens_consumed = 0; |
| 44 intptr_t CompilerStats::num_token_checks = 0; | 44 intptr_t CompilerStats::num_token_checks = 0; |
| 45 intptr_t CompilerStats::num_tokens_rewind = 0; | 45 intptr_t CompilerStats::num_tokens_rewind = 0; |
| 46 intptr_t CompilerStats::num_tokens_lookahead = 0; | 46 intptr_t CompilerStats::num_tokens_lookahead = 0; |
| 47 | 47 |
| 48 void CompilerStats::Print() { | 48 void CompilerStats::Print() { |
| 49 if (!FLAG_compiler_stats) { | 49 if (!FLAG_compiler_stats) { |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 OS::Print("==== Compiler Stats ====\n"); | 52 OS::Print("==== Compiler Stats ====\n"); |
| 53 OS::Print("Number of tokens: %ld\n", num_tokens_total); | 53 OS::Print("Number of tokens: %"Pd"\n", num_tokens_total); |
| 54 OS::Print(" Literal tokens: %ld\n", num_literal_tokens_total); | 54 OS::Print(" Literal tokens: %"Pd"\n", num_literal_tokens_total); |
| 55 OS::Print(" Ident tokens: %ld\n", num_ident_tokens_total); | 55 OS::Print(" Ident tokens: %"Pd"\n", num_ident_tokens_total); |
| 56 OS::Print("Tokens consumed: %ld (%.2f times number of tokens)\n", | 56 OS::Print("Tokens consumed: %"Pd" (%.2f times number of tokens)\n", |
| 57 num_tokens_consumed, | 57 num_tokens_consumed, |
| 58 (1.0 * num_tokens_consumed) / num_tokens_total); | 58 (1.0 * num_tokens_consumed) / num_tokens_total); |
| 59 OS::Print("Tokens checked: %ld (%.2f times tokens consumed)\n", | 59 OS::Print("Tokens checked: %"Pd" (%.2f times tokens consumed)\n", |
| 60 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); | 60 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); |
| 61 OS::Print("Token rewind: %ld (%ld%% of tokens checked)\n", | 61 OS::Print("Token rewind: %"Pd" (%"Pd"%% of tokens checked)\n", |
| 62 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); | 62 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); |
| 63 OS::Print("Token lookahead: %ld (%ld%% of tokens checked)\n", | 63 OS::Print("Token lookahead: %"Pd" (%"Pd"%% of tokens checked)\n", |
| 64 num_tokens_lookahead, | 64 num_tokens_lookahead, |
| 65 (100 * num_tokens_lookahead) / num_token_checks); | 65 (100 * num_tokens_lookahead) / num_token_checks); |
| 66 OS::Print("Source length: %ld characters\n", src_length); | 66 OS::Print("Source length: %"Pd" characters\n", src_length); |
| 67 intptr_t scan_usecs = scanner_timer.TotalElapsedTime(); | 67 intptr_t scan_usecs = scanner_timer.TotalElapsedTime(); |
| 68 OS::Print("Scanner time: %ld msecs\n", | 68 OS::Print("Scanner time: %"Pd" msecs\n", |
| 69 scan_usecs / 1000); | 69 scan_usecs / 1000); |
| 70 intptr_t parse_usecs = parser_timer.TotalElapsedTime(); | 70 intptr_t parse_usecs = parser_timer.TotalElapsedTime(); |
| 71 OS::Print("Parser time: %ld msecs\n", | 71 OS::Print("Parser time: %"Pd" msecs\n", |
| 72 parse_usecs / 1000); | 72 parse_usecs / 1000); |
| 73 intptr_t codegen_usecs = codegen_timer.TotalElapsedTime(); | 73 intptr_t codegen_usecs = codegen_timer.TotalElapsedTime(); |
| 74 OS::Print("Code gen. time: %ld msecs\n", | 74 OS::Print("Code gen. time: %"Pd" msecs\n", |
| 75 codegen_usecs / 1000); | 75 codegen_usecs / 1000); |
| 76 intptr_t graphbuilder_usecs = graphbuilder_timer.TotalElapsedTime(); | 76 intptr_t graphbuilder_usecs = graphbuilder_timer.TotalElapsedTime(); |
| 77 OS::Print(" Graph builder time: %ld msecs\n", graphbuilder_usecs / 1000); | 77 OS::Print(" Graph builder time: %"Pd" msecs\n", graphbuilder_usecs / 1000); |
| 78 intptr_t graphcompiler_usecs = graphcompiler_timer.TotalElapsedTime(); | 78 intptr_t graphcompiler_usecs = graphcompiler_timer.TotalElapsedTime(); |
| 79 OS::Print(" Graph comp. time: %ld msecs\n", graphcompiler_usecs / 1000); | 79 OS::Print(" Graph comp. time: %"Pd" msecs\n", graphcompiler_usecs / 1000); |
| 80 intptr_t codefinalizer_usecs = codefinalizer_timer.TotalElapsedTime(); | 80 intptr_t codefinalizer_usecs = codefinalizer_timer.TotalElapsedTime(); |
| 81 OS::Print(" Code final. time: %ld msecs\n", codefinalizer_usecs / 1000); | 81 OS::Print(" Code final. time: %"Pd" msecs\n", codefinalizer_usecs / 1000); |
| 82 OS::Print("Compilation speed: %ld tokens per msec\n", | 82 OS::Print("Compilation speed: %"Pd" tokens per msec\n", |
| 83 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); | 83 1000 * num_tokens_total / (parse_usecs + codegen_usecs)); |
| 84 OS::Print("Code size: %ld KB\n", | 84 OS::Print("Code size: %"Pd" KB\n", |
| 85 code_allocated / 1024); | 85 code_allocated / 1024); |
| 86 OS::Print("Code density: %ld tokens per KB\n", | 86 OS::Print("Code density: %"Pd" tokens per KB\n", |
| 87 num_tokens_total * 1024 / code_allocated); | 87 num_tokens_total * 1024 / code_allocated); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace dart | 90 } // namespace dart |
| OLD | NEW |