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 #ifndef VM_COMPILER_STATS_H_ | 5 #ifndef VM_COMPILER_STATS_H_ |
6 #define VM_COMPILER_STATS_H_ | 6 #define VM_COMPILER_STATS_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/isolate.h" | |
10 #include "vm/timer.h" | 11 #include "vm/timer.h" |
11 | 12 |
12 | 13 |
13 | 14 |
14 namespace dart { | 15 namespace dart { |
15 | 16 |
16 DECLARE_FLAG(bool, compiler_stats); | 17 DECLARE_FLAG(bool, compiler_stats); |
17 | 18 |
18 class CompilerStats : AllStatic { | 19 // TODO(hausner): Might want to expose some of these values in the |
20 // observatory. Use the metrics mechanism (metrics.h) for this. | |
21 | |
22 class CompilerStats { | |
19 public: | 23 public: |
20 static int64_t num_tokens_total; | 24 explicit CompilerStats(Isolate* isolate); |
21 static int64_t num_literal_tokens_total; | 25 ~CompilerStats() { } |
22 static int64_t num_ident_tokens_total; | |
23 static int64_t num_tokens_consumed; | |
24 static int64_t num_token_checks; | |
25 static int64_t num_tokens_rewind; | |
26 static int64_t num_tokens_lookahead; | |
27 | 26 |
28 static int64_t num_lib_cache_hit; | 27 Isolate* isolate_; |
29 static int64_t num_names_cached; | |
30 static int64_t make_accessor_name; | |
31 static int64_t make_field_name; | |
32 | 28 |
33 static int64_t num_classes_compiled; | 29 // DODO(hausner): add these timers to the timer list maintained |
siva
2015/05/12 22:12:32
TODO
hausner
2015/05/12 22:49:53
:)
| |
34 static int64_t num_functions_compiled; | 30 // in the isolate? |
35 static int64_t num_implicit_final_getters; | 31 Timer parser_timer; // Cumulative runtime of parser. |
36 static int64_t num_static_initializer_funcs; | 32 Timer scanner_timer; // Cumulative runtime of scanner. |
33 Timer codegen_timer; // Cumulative runtime of code generator. | |
34 Timer graphbuilder_timer; // Included in codegen_timer. | |
35 Timer ssa_timer; // Included in codegen_timer. | |
36 Timer graphinliner_timer; // Included in codegen_timer. | |
37 Timer graphinliner_parse_timer; // Included in codegen_timer. | |
38 Timer graphinliner_build_timer; // Included in codegen_timer. | |
39 Timer graphinliner_ssa_timer; // Included in codegen_timer. | |
40 Timer graphinliner_opt_timer; // Included in codegen_timer. | |
41 Timer graphinliner_subst_timer; // Included in codegen_timer. | |
37 | 42 |
38 static int64_t src_length; // Total number of characters in source. | 43 Timer graphoptimizer_timer; // Included in codegen_timer. |
39 static int64_t code_allocated; // Bytes allocated for generated code. | 44 Timer graphcompiler_timer; // Included in codegen_timer. |
40 static Timer parser_timer; // Cumulative runtime of parser. | 45 Timer codefinalizer_timer; // Included in codegen_timer. |
41 static Timer scanner_timer; // Cumulative runtime of scanner. | |
42 static Timer codegen_timer; // Cumulative runtime of code generator. | |
43 static Timer graphbuilder_timer; // Included in codegen_timer. | |
44 static Timer ssa_timer; // Included in codegen_timer. | |
45 static Timer graphinliner_timer; // Included in codegen_timer. | |
46 static Timer graphinliner_parse_timer; // Included in codegen_timer. | |
47 static Timer graphinliner_build_timer; // Included in codegen_timer. | |
48 static Timer graphinliner_ssa_timer; // Included in codegen_timer. | |
49 static Timer graphinliner_opt_timer; // Included in codegen_timer. | |
50 static Timer graphinliner_find_timer; // Included in codegen_timer. | |
51 static Timer graphinliner_plug_timer; // Included in codegen_timer. | |
52 static Timer graphinliner_subst_timer; // Included in codegen_timer. | |
53 | 46 |
54 static Timer graphoptimizer_timer; // Included in codegen_timer. | 47 int64_t num_tokens_total; |
55 static Timer graphcompiler_timer; // Included in codegen_timer. | 48 int64_t num_literal_tokens_total; |
56 static Timer codefinalizer_timer; // Included in codegen_timer. | 49 int64_t num_ident_tokens_total; |
50 int64_t num_tokens_consumed; | |
51 int64_t num_token_checks; | |
52 int64_t num_tokens_rewind; | |
53 int64_t num_tokens_lookahead; | |
57 | 54 |
58 static void Print(); | 55 int64_t num_classes_compiled; |
56 int64_t num_functions_compiled; | |
57 int64_t num_implicit_final_getters; | |
58 | |
59 int64_t src_length; // Total number of characters in source. | |
60 int64_t total_code_size; // Bytes allocated for code and meta info. | |
61 int64_t total_instr_size; // Total size of generated code in bytes. | |
62 int64_t pc_desc_size; | |
63 int64_t vardesc_size; | |
64 | |
65 void Print(); | |
59 }; | 66 }; |
60 | 67 |
68 #define INC_STAT(isolate, counter, incr) \ | |
69 if (FLAG_compiler_stats) { (isolate)->compiler_stats()->counter += (incr); } | |
70 | |
71 #define CSTAT_TIMER_SCOPE(iso, t) \ | |
72 TimerScope timer(FLAG_compiler_stats, \ | |
73 FLAG_compiler_stats ? &((iso)->compiler_stats()->t) : NULL, \ | |
74 iso); | |
siva
2015/05/12 22:12:31
indent of backslash seems off.
hausner
2015/05/12 22:49:53
Done.
| |
61 | 75 |
62 } // namespace dart | 76 } // namespace dart |
63 | 77 |
64 #endif // VM_COMPILER_STATS_H_ | 78 #endif // VM_COMPILER_STATS_H_ |
OLD | NEW |