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

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

Issue 1127383008: Fix CompilerStats info (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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
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.
16 int64_t CompilerStats::code_allocated = 0;
17 15
18 // Total number of characters in source. 16 CompilerStats::CompilerStats(Isolate* isolate)
19 int64_t CompilerStats::src_length = 0; 17 : isolate_(isolate),
18 parser_timer(true, "parser timer"),
19 scanner_timer(true, "scanner timer"),
20 codegen_timer(true, "codegen timer"),
21 graphbuilder_timer(true, "flow graph builder timer"),
22 ssa_timer(true, "flow graph SSA timer"),
23 graphinliner_timer(true, "flow graph inliner timer"),
24 graphinliner_parse_timer(true, "inliner parsing timer"),
25 graphinliner_build_timer(true, "inliner building timer"),
26 graphinliner_ssa_timer(true, "inliner SSA timer"),
27 graphinliner_opt_timer(true, "inliner optimization timer"),
28 graphinliner_subst_timer(true, "inliner substitution timer"),
29 graphoptimizer_timer(true, "flow graph optimizer timer"),
30 graphcompiler_timer(true, "flow graph compiler timer"),
31 codefinalizer_timer(true, "code finalization timer") {
32 total_code_size = 0;
33 src_length = 0;
34 num_tokens_total = 0;
35 num_literal_tokens_total = 0;
36 num_ident_tokens_total = 0;
37 num_tokens_consumed = 0;
38 num_token_checks = 0;
39 num_tokens_rewind = 0;
40 num_tokens_lookahead = 0;
41 num_classes_compiled = 0;
42 num_functions_compiled = 0;
43 num_implicit_final_getters = 0;
44 total_instr_size = 0;
45 pc_desc_size = 0;
46 vardesc_size = 0;
siva 2015/05/12 17:39:52 Why are these initialized in the body and not in t
hausner 2015/05/12 21:52:16 Done.
47 }
20 48
21 // Cumulative runtime of parser.
22 Timer CompilerStats::parser_timer(true, "parser timer");
23
24 // Cumulative runtime of scanner.
25 Timer CompilerStats::scanner_timer(true, "scanner timer");
26
27 // Cumulative runtime of code generator.
28 Timer CompilerStats::codegen_timer(true, "codegen timer");
29
30 // Cumulative timer of flow graph builder, included in codegen_timer.
31 Timer CompilerStats::graphbuilder_timer(true, "flow graph builder timer");
32
33 // Cumulative timer of flow graph SSA construction, included in codegen_timer.
34 Timer CompilerStats::ssa_timer(true, "flow graph SSA timer");
35
36 // Cumulative timer of flow graph inliner, included in codegen_timer.
37 Timer CompilerStats::graphinliner_timer(true, "flow graph inliner timer");
38 // Cumulative sub-timers of flow graph inliner.
39 Timer CompilerStats::graphinliner_parse_timer(true, "inliner parsing timer");
40 Timer CompilerStats::graphinliner_build_timer(true, "inliner building timer");
41 Timer CompilerStats::graphinliner_ssa_timer(true, "inliner SSA timer");
42 Timer CompilerStats::graphinliner_opt_timer(true, "inliner optimization timer");
43 Timer CompilerStats::graphinliner_subst_timer(true,
44 "inliner substitution timer");
45
46 // Cumulative timer of flow graph optimizer, included in codegen_timer.
47 Timer CompilerStats::graphoptimizer_timer(true, "flow graph optimizer timer");
48
49 // Cumulative timer of flow graph compiler, included in codegen_timer.
50 Timer CompilerStats::graphcompiler_timer(true, "flow graph compiler timer");
51
52 // Cumulative timer of code finalization, included in codegen_timer.
53 Timer CompilerStats::codefinalizer_timer(true, "code finalization timer");
54
55
56 int64_t CompilerStats::num_tokens_total = 0;
57 int64_t CompilerStats::num_literal_tokens_total = 0;
58 int64_t CompilerStats::num_ident_tokens_total = 0;
59 int64_t CompilerStats::num_tokens_consumed = 0;
60 int64_t CompilerStats::num_token_checks = 0;
61 int64_t CompilerStats::num_tokens_rewind = 0;
62 int64_t CompilerStats::num_tokens_lookahead = 0;
63
64 int64_t CompilerStats::num_lib_cache_hit = 0;
65 int64_t CompilerStats::num_names_cached = 0;
66 int64_t CompilerStats::make_accessor_name = 0;
67 int64_t CompilerStats::make_field_name = 0;
68
69 int64_t CompilerStats::num_classes_compiled = 0;
70 int64_t CompilerStats::num_functions_compiled = 0;
71
72 int64_t CompilerStats::num_implicit_final_getters = 0;
73 int64_t CompilerStats::num_static_initializer_funcs = 0;
74 49
75 void CompilerStats::Print() { 50 void CompilerStats::Print() {
76 if (!FLAG_compiler_stats) { 51 if (!FLAG_compiler_stats) {
77 return; 52 return;
78 } 53 }
79 OS::Print("==== Compiler Stats ====\n"); 54 OS::Print("==== Compiler Stats for isolate '%s' ====\n",
55 isolate_->debugger_name());
80 OS::Print("Number of tokens: %" Pd64 "\n", num_tokens_total); 56 OS::Print("Number of tokens: %" Pd64 "\n", num_tokens_total);
81 OS::Print(" Literal tokens: %" Pd64 "\n", num_literal_tokens_total); 57 OS::Print(" Literal tokens: %" Pd64 "\n", num_literal_tokens_total);
82 OS::Print(" Ident tokens: %" Pd64 "\n", num_ident_tokens_total); 58 OS::Print(" Ident tokens: %" Pd64 "\n", num_ident_tokens_total);
83 OS::Print("Tokens consumed: %" Pd64 " (%.2f times number of tokens)\n", 59 OS::Print("Tokens consumed: %" Pd64 " (%.2f times number of tokens)\n",
84 num_tokens_consumed, 60 num_tokens_consumed,
85 (1.0 * num_tokens_consumed) / num_tokens_total); 61 (1.0 * num_tokens_consumed) / num_tokens_total);
86 OS::Print("Tokens checked: %" Pd64 " (%.2f times tokens consumed)\n", 62 OS::Print("Tokens checked: %" Pd64 " (%.2f times tokens consumed)\n",
87 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed); 63 num_token_checks, (1.0 * num_token_checks) / num_tokens_consumed);
88 OS::Print("Token rewind: %" Pd64 " (%" Pd64 "%% of tokens checked)\n", 64 OS::Print("Token rewind: %" Pd64 " (%" Pd64 "%% of tokens checked)\n",
89 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks); 65 num_tokens_rewind, (100 * num_tokens_rewind) / num_token_checks);
90 OS::Print("Token lookahead: %" Pd64 " (%" Pd64 "%% of tokens checked)\n", 66 OS::Print("Token lookahead: %" Pd64 " (%" Pd64 "%% of tokens checked)\n",
91 num_tokens_lookahead, 67 num_tokens_lookahead,
92 (100 * num_tokens_lookahead) / num_token_checks); 68 (100 * num_tokens_lookahead) / num_token_checks);
93 69
94 OS::Print("Classes parsed: %" Pd64 "\n", num_classes_compiled); 70 OS::Print("Classes parsed: %" Pd64 "\n", num_classes_compiled);
95 OS::Print("Functions compiled: %" Pd64 "\n", num_functions_compiled); 71 OS::Print("Functions compiled: %" Pd64 "\n", num_functions_compiled);
96 OS::Print(" Impl getters: %" Pd64 "\n", num_implicit_final_getters); 72 OS::Print(" Impl getters: %" Pd64 "\n", num_implicit_final_getters);
97 OS::Print(" Init funcs: %" Pd64 "\n", num_static_initializer_funcs);
98
99 OS::Print("Lib names cached: %" Pd64 "\n", num_names_cached);
100 OS::Print("Lib name cache hit: %" Pd64 "\n", num_lib_cache_hit);
101 OS::Print("Accessor mangling: %" Pd64 " field->acc %" Pd64 " acc->field\n",
102 make_accessor_name, make_field_name);
103 73
104 OS::Print("Source length: %" Pd64 " characters\n", src_length); 74 OS::Print("Source length: %" Pd64 " characters\n", src_length);
105 int64_t scan_usecs = scanner_timer.TotalElapsedTime(); 75 int64_t scan_usecs = scanner_timer.TotalElapsedTime();
106 OS::Print("Scanner time: %" Pd64 " msecs\n", 76 OS::Print("Scanner time: %" Pd64 " msecs\n",
107 scan_usecs / 1000); 77 scan_usecs / 1000);
108 int64_t parse_usecs = parser_timer.TotalElapsedTime(); 78 int64_t parse_usecs = parser_timer.TotalElapsedTime();
109 OS::Print("Parser time: %" Pd64 " msecs\n", 79 OS::Print("Parser time: %" Pd64 " msecs\n",
110 parse_usecs / 1000); 80 parse_usecs / 1000);
111 int64_t codegen_usecs = codegen_timer.TotalElapsedTime(); 81 int64_t codegen_usecs = codegen_timer.TotalElapsedTime();
112 OS::Print("Code gen. time: %" Pd64 " msecs\n", 82 OS::Print("Code gen. time: %" Pd64 " msecs\n",
(...skipping 28 matching lines...) Expand all
141 OS::Print(" Graph optimizer: %" Pd64 " msecs\n", 111 OS::Print(" Graph optimizer: %" Pd64 " msecs\n",
142 (graphoptimizer_usecs - graphinliner_usecs) / 1000); 112 (graphoptimizer_usecs - graphinliner_usecs) / 1000);
143 int64_t graphcompiler_usecs = graphcompiler_timer.TotalElapsedTime(); 113 int64_t graphcompiler_usecs = graphcompiler_timer.TotalElapsedTime();
144 OS::Print(" Graph compiler: %" Pd64 " msecs\n", 114 OS::Print(" Graph compiler: %" Pd64 " msecs\n",
145 graphcompiler_usecs / 1000); 115 graphcompiler_usecs / 1000);
146 int64_t codefinalizer_usecs = codefinalizer_timer.TotalElapsedTime(); 116 int64_t codefinalizer_usecs = codefinalizer_timer.TotalElapsedTime();
147 OS::Print(" Code finalizer: %" Pd64 " msecs\n", 117 OS::Print(" Code finalizer: %" Pd64 " msecs\n",
148 codefinalizer_usecs / 1000); 118 codefinalizer_usecs / 1000);
149 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n", 119 OS::Print("Compilation speed: %" Pd64 " tokens per msec\n",
150 (1000 * num_tokens_total) / (parse_usecs + codegen_usecs)); 120 (1000 * num_tokens_total) / (parse_usecs + codegen_usecs));
151 OS::Print("Code size: %" Pd64 " KB\n",
152 code_allocated / 1024);
153 OS::Print("Code density: %" Pd64 " tokens per KB\n", 121 OS::Print("Code density: %" Pd64 " tokens per KB\n",
154 (num_tokens_total * 1024) / code_allocated); 122 (num_tokens_total * 1024) / total_instr_size);
123 OS::Print("Instr size: %" Pd64 " KB\n",
124 total_instr_size / 1024);
125 OS::Print("Pc Desc size: %" Pd64 " KB\n", pc_desc_size / 1024);
126 OS::Print("VarDesc size: %" Pd64 " KB\n", vardesc_size / 1024);
127
128 OS::Print("Code size: %" Pd64 " KB\n", total_code_size / 1024);
155 } 129 }
156 130
157 } // namespace dart 131 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698