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 class CompilerStats { |
siva
2015/05/12 17:39:52
Should this extend ValueObject? See comment in iso
hausner
2015/05/12 21:52:16
I want to avoid allocating the CompilerStats struc
| |
19 public: | 20 public: |
20 static int64_t num_tokens_total; | 21 explicit CompilerStats(Isolate* isolate); |
21 static int64_t num_literal_tokens_total; | 22 ~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 | 23 |
28 static int64_t num_lib_cache_hit; | 24 Isolate* isolate_; |
29 static int64_t num_names_cached; | |
30 static int64_t make_accessor_name; | |
31 static int64_t make_field_name; | |
32 | 25 |
33 static int64_t num_classes_compiled; | 26 int64_t num_tokens_total; |
34 static int64_t num_functions_compiled; | 27 int64_t num_literal_tokens_total; |
35 static int64_t num_implicit_final_getters; | 28 int64_t num_ident_tokens_total; |
36 static int64_t num_static_initializer_funcs; | 29 int64_t num_tokens_consumed; |
30 int64_t num_token_checks; | |
31 int64_t num_tokens_rewind; | |
32 int64_t num_tokens_lookahead; | |
37 | 33 |
38 static int64_t src_length; // Total number of characters in source. | 34 int64_t num_classes_compiled; |
39 static int64_t code_allocated; // Bytes allocated for generated code. | 35 int64_t num_functions_compiled; |
40 static Timer parser_timer; // Cumulative runtime of parser. | 36 int64_t num_implicit_final_getters; |
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 | 37 |
54 static Timer graphoptimizer_timer; // Included in codegen_timer. | 38 int64_t src_length; // Total number of characters in source. |
55 static Timer graphcompiler_timer; // Included in codegen_timer. | 39 Timer parser_timer; // Cumulative runtime of parser. |
56 static Timer codefinalizer_timer; // Included in codegen_timer. | 40 Timer scanner_timer; // Cumulative runtime of scanner. |
41 Timer codegen_timer; // Cumulative runtime of code generator. | |
42 Timer graphbuilder_timer; // Included in codegen_timer. | |
43 Timer ssa_timer; // Included in codegen_timer. | |
44 Timer graphinliner_timer; // Included in codegen_timer. | |
45 Timer graphinliner_parse_timer; // Included in codegen_timer. | |
46 Timer graphinliner_build_timer; // Included in codegen_timer. | |
47 Timer graphinliner_ssa_timer; // Included in codegen_timer. | |
48 Timer graphinliner_opt_timer; // Included in codegen_timer. | |
49 Timer graphinliner_subst_timer; // Included in codegen_timer. | |
57 | 50 |
58 static void Print(); | 51 Timer graphoptimizer_timer; // Included in codegen_timer. |
52 Timer graphcompiler_timer; // Included in codegen_timer. | |
53 Timer codefinalizer_timer; // Included in codegen_timer. | |
54 | |
55 int64_t total_code_size; // Bytes allocated for code and meta info. | |
56 int64_t total_instr_size; // Total size of generated code in bytes. | |
57 int64_t pc_desc_size; | |
58 int64_t vardesc_size; | |
59 | |
60 void Print(); | |
59 }; | 61 }; |
60 | 62 |
63 #define INC_STAT(isolate, counter, incr) \ | |
64 if (FLAG_compiler_stats) { isolate->compiler_stats()->counter += (incr); } | |
65 | |
66 #define CSTAT_TIMER(t) Isolate::Current()->compiler_stats()->t | |
siva
2015/05/12 17:39:52
Why doesn't this take an isolate param like INC_ST
hausner
2015/05/12 21:52:16
I tried to keep the code that uses the macro short
| |
61 | 67 |
62 } // namespace dart | 68 } // namespace dart |
63 | 69 |
64 #endif // VM_COMPILER_STATS_H_ | 70 #endif // VM_COMPILER_STATS_H_ |
OLD | NEW |