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

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

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/compiler_stats.cc » ('j') | 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 #ifndef RUNTIME_VM_COMPILER_STATS_H_ 5 #ifndef RUNTIME_VM_COMPILER_STATS_H_
6 #define RUNTIME_VM_COMPILER_STATS_H_ 6 #define RUNTIME_VM_COMPILER_STATS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 14 matching lines...) Expand all
25 V(graphbuilder_timer, "flow graph builder timer") \ 25 V(graphbuilder_timer, "flow graph builder timer") \
26 V(ssa_timer, "flow graph SSA timer") \ 26 V(ssa_timer, "flow graph SSA timer") \
27 V(graphinliner_timer, "flow graph inliner timer") \ 27 V(graphinliner_timer, "flow graph inliner timer") \
28 V(graphinliner_parse_timer, "inliner parsing timer") \ 28 V(graphinliner_parse_timer, "inliner parsing timer") \
29 V(graphinliner_build_timer, "inliner building timer") \ 29 V(graphinliner_build_timer, "inliner building timer") \
30 V(graphinliner_ssa_timer, "inliner SSA timer") \ 30 V(graphinliner_ssa_timer, "inliner SSA timer") \
31 V(graphinliner_opt_timer, "inliner optimization timer") \ 31 V(graphinliner_opt_timer, "inliner optimization timer") \
32 V(graphinliner_subst_timer, "inliner substitution timer") \ 32 V(graphinliner_subst_timer, "inliner substitution timer") \
33 V(graphoptimizer_timer, "flow graph optimizer timer") \ 33 V(graphoptimizer_timer, "flow graph optimizer timer") \
34 V(graphcompiler_timer, "flow graph compiler timer") \ 34 V(graphcompiler_timer, "flow graph compiler timer") \
35 V(codefinalizer_timer, "code finalization timer") \ 35 V(codefinalizer_timer, "code finalization timer")
36 36
37 37
38 #define STAT_COUNTERS(V) \ 38 #define STAT_COUNTERS(V) \
39 V(num_tokens_total) \ 39 V(num_tokens_total) \
40 V(num_tokens_scanned) \ 40 V(num_tokens_scanned) \
41 V(num_tokens_consumed) \ 41 V(num_tokens_consumed) \
42 V(num_cached_consts) \ 42 V(num_cached_consts) \
43 V(num_const_cache_hits) \ 43 V(num_const_cache_hits) \
44 V(num_execute_const) \ 44 V(num_execute_const) \
45 V(num_classes_parsed) \ 45 V(num_classes_parsed) \
46 V(num_class_tokens) \ 46 V(num_class_tokens) \
47 V(num_functions_parsed) \ 47 V(num_functions_parsed) \
48 V(num_functions_compiled) \ 48 V(num_functions_compiled) \
49 V(num_functions_optimized) \ 49 V(num_functions_optimized) \
50 V(num_func_tokens_compiled) \ 50 V(num_func_tokens_compiled) \
51 V(num_implicit_final_getters) \ 51 V(num_implicit_final_getters) \
52 V(num_method_extractors) \ 52 V(num_method_extractors) \
53 V(src_length) \ 53 V(src_length) \
54 V(total_code_size) \ 54 V(total_code_size) \
55 V(total_instr_size) \ 55 V(total_instr_size) \
56 V(pc_desc_size) \ 56 V(pc_desc_size) \
57 V(vardesc_size) \ 57 V(vardesc_size)
58 58
59 class CompilerStats { 59 class CompilerStats {
60 public: 60 public:
61 explicit CompilerStats(Isolate* isolate); 61 explicit CompilerStats(Isolate* isolate);
62 ~CompilerStats() { } 62 ~CompilerStats() {}
63 63
64 Isolate* isolate_; 64 Isolate* isolate_;
65 65
66 // We could use STAT_TIMERS and STAT_COUNTERS to declare fields, but then 66 // We could use STAT_TIMERS and STAT_COUNTERS to declare fields, but then
67 // we would be losing the comments. 67 // we would be losing the comments.
68 Timer parser_timer; // Cumulative runtime of parser. 68 Timer parser_timer; // Cumulative runtime of parser.
69 Timer scanner_timer; // Cumulative runtime of scanner. 69 Timer scanner_timer; // Cumulative runtime of scanner.
70 Timer codegen_timer; // Cumulative runtime of code generator. 70 Timer codegen_timer; // Cumulative runtime of code generator.
71 Timer graphbuilder_timer; // Included in codegen_timer. 71 Timer graphbuilder_timer; // Included in codegen_timer.
72 Timer ssa_timer; // Included in codegen_timer. 72 Timer ssa_timer; // Included in codegen_timer.
73 Timer graphinliner_timer; // Included in codegen_timer. 73 Timer graphinliner_timer; // Included in codegen_timer.
74 Timer graphinliner_parse_timer; // Included in codegen_timer. 74 Timer graphinliner_parse_timer; // Included in codegen_timer.
75 Timer graphinliner_build_timer; // Included in codegen_timer. 75 Timer graphinliner_build_timer; // Included in codegen_timer.
76 Timer graphinliner_ssa_timer; // Included in codegen_timer. 76 Timer graphinliner_ssa_timer; // Included in codegen_timer.
77 Timer graphinliner_opt_timer; // Included in codegen_timer. 77 Timer graphinliner_opt_timer; // Included in codegen_timer.
78 Timer graphinliner_subst_timer; // Included in codegen_timer. 78 Timer graphinliner_subst_timer; // Included in codegen_timer.
79 79
80 Timer graphoptimizer_timer; // Included in codegen_timer. 80 Timer graphoptimizer_timer; // Included in codegen_timer.
81 Timer graphcompiler_timer; // Included in codegen_timer. 81 Timer graphcompiler_timer; // Included in codegen_timer.
82 Timer codefinalizer_timer; // Included in codegen_timer. 82 Timer codefinalizer_timer; // Included in codegen_timer.
83 83
84 int64_t num_tokens_total; // Isolate + VM isolate 84 int64_t num_tokens_total; // Isolate + VM isolate
85 int64_t num_tokens_scanned; 85 int64_t num_tokens_scanned;
86 int64_t num_tokens_consumed; 86 int64_t num_tokens_consumed;
87 int64_t num_cached_consts; 87 int64_t num_cached_consts;
88 int64_t num_const_cache_hits; 88 int64_t num_const_cache_hits;
89 int64_t num_execute_const; 89 int64_t num_execute_const;
90 90
91 int64_t num_classes_parsed; 91 int64_t num_classes_parsed;
92 int64_t num_class_tokens; 92 int64_t num_class_tokens;
93 int64_t num_functions_parsed; // Num parsed functions. 93 int64_t num_functions_parsed; // Num parsed functions.
94 int64_t num_functions_compiled; // Num unoptimized compilations. 94 int64_t num_functions_compiled; // Num unoptimized compilations.
95 int64_t num_functions_optimized; // Num optimized compilations. 95 int64_t num_functions_optimized; // Num optimized compilations.
96 int64_t num_func_tokens_compiled; 96 int64_t num_func_tokens_compiled;
97 int64_t num_implicit_final_getters; 97 int64_t num_implicit_final_getters;
98 int64_t num_method_extractors; 98 int64_t num_method_extractors;
99 99
100 int64_t src_length; // Total number of characters in source. 100 int64_t src_length; // Total number of characters in source.
101 int64_t total_code_size; // Bytes allocated for code and meta info. 101 int64_t total_code_size; // Bytes allocated for code and meta info.
102 int64_t total_instr_size; // Total size of generated code in bytes. 102 int64_t total_instr_size; // Total size of generated code in bytes.
103 int64_t pc_desc_size; 103 int64_t pc_desc_size;
104 int64_t vardesc_size; 104 int64_t vardesc_size;
105 char* text; 105 char* text;
106 bool use_benchmark_output; 106 bool use_benchmark_output;
107 107
108 108
109 void EnableBenchmark(); 109 void EnableBenchmark();
110 char* BenchmarkOutput(); 110 char* BenchmarkOutput();
111 char* PrintToZone(); 111 char* PrintToZone();
112 112
113 // Used to aggregate stats. 113 // Used to aggregate stats.
114 void Add(const CompilerStats& other); 114 void Add(const CompilerStats& other);
115 void Clear(); 115 void Clear();
116 116
117 bool IsCleared() const; 117 bool IsCleared() const;
118 118
119 private: 119 private:
120 // Update stats that are computed, e.g. token count. 120 // Update stats that are computed, e.g. token count.
121 void Update(); 121 void Update();
122 }; 122 };
123 123
124 // Make increment atomic in case it occurs in parallel with aggregation from 124 // Make increment atomic in case it occurs in parallel with aggregation from
125 // other thread. 125 // other thread.
126 #define INC_STAT(thread, counter, incr) \ 126 #define INC_STAT(thread, counter, incr) \
127 if (FLAG_support_compiler_stats && FLAG_compiler_stats) { \ 127 if (FLAG_support_compiler_stats && FLAG_compiler_stats) { \
128 AtomicOperations::IncrementInt64By( \ 128 AtomicOperations::IncrementInt64By(&(thread)->compiler_stats()->counter, \
129 &(thread)->compiler_stats()->counter, (incr)); \ 129 (incr)); \
130 } 130 }
131 131
132 #define STAT_VALUE(thread, counter) \ 132 #define STAT_VALUE(thread, counter) \
133 ((FLAG_support_compiler_stats && FLAG_compiler_stats) ? \ 133 ((FLAG_support_compiler_stats && FLAG_compiler_stats) \
134 (thread)->compiler_stats()->counter : 0) 134 ? (thread)->compiler_stats()->counter \
135 : 0)
135 136
136 #define CSTAT_TIMER_SCOPE(thr, t) \ 137 #define CSTAT_TIMER_SCOPE(thr, t) \
137 TimerScope timer(FLAG_support_compiler_stats && FLAG_compiler_stats, \ 138 TimerScope timer(FLAG_support_compiler_stats&& FLAG_compiler_stats, \
138 (FLAG_support_compiler_stats && FLAG_compiler_stats) ? \ 139 (FLAG_support_compiler_stats && FLAG_compiler_stats) \
139 &((thr)->compiler_stats()->t) : NULL, \ 140 ? &((thr)->compiler_stats()->t) \
140 thr); 141 : NULL, \
142 thr);
141 143
142 144
143 } // namespace dart 145 } // namespace dart
144 146
145 #endif // RUNTIME_VM_COMPILER_STATS_H_ 147 #endif // RUNTIME_VM_COMPILER_STATS_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/compiler_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698