Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: runtime/vm/compiler_stats.cc

Issue 10084014: Measure code generation time as well. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« runtime/vm/compiler.cc ('K') | « runtime/vm/compiler_stats.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 namespace dart { 11 namespace dart {
12 12
13 DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters."); 13 DEFINE_FLAG(bool, compiler_stats, false, "Compiler stat counters.");
14 14
15 // Bytes allocated for generated code. 15 // Bytes allocated for generated code.
16 intptr_t CompilerStats::code_allocated = 0; 16 intptr_t CompilerStats::code_allocated = 0;
17 17
18 // Total number of characters in source. 18 // Total number of characters in source.
19 intptr_t CompilerStats::src_length = 0; 19 intptr_t CompilerStats::src_length = 0;
20 20
21 // Cumulative runtime of parser. 21 // Cumulative runtime of parser.
22 Timer CompilerStats::parser_timer(true, "parser timer"); 22 Timer CompilerStats::parser_timer(true, "parser timer");
23 23
24 // Cumulative runtime of scanner. 24 // Cumulative runtime of scanner.
25 Timer CompilerStats::scanner_timer(true, "scanner timer"); 25 Timer CompilerStats::scanner_timer(true, "scanner timer");
26 26
27 // Cumulative runtime of code generator.
28 Timer CompilerStats::codegen_timer(true, "codegen timer");
29
27 intptr_t CompilerStats::num_tokens_total = 0; 30 intptr_t CompilerStats::num_tokens_total = 0;
28 intptr_t CompilerStats::num_literal_tokens_total = 0; 31 intptr_t CompilerStats::num_literal_tokens_total = 0;
29 intptr_t CompilerStats::num_ident_tokens_total = 0; 32 intptr_t CompilerStats::num_ident_tokens_total = 0;
30 intptr_t CompilerStats::num_tokens_consumed = 0; 33 intptr_t CompilerStats::num_tokens_consumed = 0;
31 intptr_t CompilerStats::num_token_checks = 0; 34 intptr_t CompilerStats::num_token_checks = 0;
32 intptr_t CompilerStats::num_tokens_rewind = 0; 35 intptr_t CompilerStats::num_tokens_rewind = 0;
33 intptr_t CompilerStats::num_tokens_lookahead = 0; 36 intptr_t CompilerStats::num_tokens_lookahead = 0;
34 37
35 void CompilerStats::Print() { 38 void CompilerStats::Print() {
36 if (!FLAG_compiler_stats) { 39 if (!FLAG_compiler_stats) {
(...skipping 11 matching lines...) Expand all
48 OS::Print("Token rewind: %ld (%ld%% of tokens checked)\n", 51 OS::Print("Token rewind: %ld (%ld%% of tokens checked)\n",
49 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); 52 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks);
50 OS::Print("Token lookahead: %ld (%ld%% of tokens checked)\n", 53 OS::Print("Token lookahead: %ld (%ld%% of tokens checked)\n",
51 num_tokens_lookahead, 54 num_tokens_lookahead,
52 (100 * num_tokens_lookahead) / num_token_checks); 55 (100 * num_tokens_lookahead) / num_token_checks);
53 OS::Print("Source length: %ld characters\n", src_length); 56 OS::Print("Source length: %ld characters\n", src_length);
54 intptr_t scan_usecs = scanner_timer.TotalElapsedTime(); 57 intptr_t scan_usecs = scanner_timer.TotalElapsedTime();
55 OS::Print("Scanner time: %ld msecs\n", 58 OS::Print("Scanner time: %ld msecs\n",
56 scan_usecs / 1000); 59 scan_usecs / 1000);
57 intptr_t parse_usecs = parser_timer.TotalElapsedTime(); 60 intptr_t parse_usecs = parser_timer.TotalElapsedTime();
58 OS::Print("Compilation time: %ld msecs\n", 61 OS::Print("Parser time: %ld msecs\n",
59 parse_usecs / 1000); 62 parse_usecs / 1000);
63 intptr_t codegen_usecs = codegen_timer.TotalElapsedTime();
64 OS::Print("Code gen. time: %ld msecs\n",
65 codegen_usecs / 1000);
60 OS::Print("Compilation speed: %ld tokens per msec\n", 66 OS::Print("Compilation speed: %ld tokens per msec\n",
61 1000 * num_tokens_total / parse_usecs); 67 1000 * num_tokens_total / (parse_usecs + codegen_usecs));
62 OS::Print("Code size: %ld KB\n", 68 OS::Print("Code size: %ld KB\n",
63 code_allocated / 1024); 69 code_allocated / 1024);
64 OS::Print("Code density: %ld tokens per KB\n", 70 OS::Print("Code density: %ld tokens per KB\n",
65 num_tokens_total * 1024 / code_allocated); 71 num_tokens_total * 1024 / code_allocated);
66 } 72 }
67 73
68 } // namespace dart 74 } // namespace dart
OLDNEW
« runtime/vm/compiler.cc ('K') | « runtime/vm/compiler_stats.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698