5#ifndef RUNTIME_VM_COMPILER_COMPILER_TIMINGS_H_
6#define RUNTIME_VM_COMPILER_COMPILER_TIMINGS_H_
15#if defined(DART_PRECOMPILED_RUNTIME)
16#error "AOT runtime should not use compiler sources (including header files)"
19#define PRECOMPILER_TIMERS_LIST(V) \
24 V(CheckForNewDynamicFunctions) \
25 V(CollectCallbackFields) \
26 V(PrecompileConstructors) \
27 V(AttachOptimizedTypeTestingStub) \
28 V(TraceForRetainedFunctions) \
29 V(FinalizeDispatchTable) \
30 V(ReplaceFunctionStaticCallEntries) \
36#define INLINING_TIMERS_LIST(V) \
38 V(PopulateWithICData) \
41 V(MakeInliningDecision) \
44 V(InlineRecognizedMethod) \
46 V(BuildDecisionGraph) \
51#define COMPILER_TIMERS_LIST(V) \
52 COMPILER_PASS_LIST(V) \
53 PRECOMPILER_TIMERS_LIST(V) \
54 INLINING_TIMERS_LIST(V) \
75 Timer timers_[kNumTimers];
76 std::unique_ptr<Timers> nested_[kNumTimers];
81#define DECLARE_TIMER_ID(Name) k##Name,
83#undef DECLARE_TIMER_ID
91 if (stats_ !=
nullptr) {
92 outer_nested_ = stats_->nested_;
93 if (*outer_nested_ ==
nullptr) {
95 *outer_nested_ = std::make_unique<Timers>();
98 timer_ = &(*outer_nested_)->timers_[
id];
99 stats_->nested_ = &(*outer_nested_)->nested_[
id];
106 if (stats_ !=
nullptr) {
108 stats_->nested_ = outer_nested_;
115 std::unique_ptr<Timers>* outer_nested_;
122 try_inlining_success_.
AddTotal(timer);
124 try_inlining_failure_.
AddTotal(timer);
131 void PrintTimers(
Zone* zone,
132 const std::unique_ptr<CompilerTimings::Timers>& timers,
137 std::unique_ptr<Timers> root_ = std::make_unique<Timers>();
140 std::unique_ptr<Timers>* nested_ = &root_;
142 Timer try_inlining_success_;
143 Timer try_inlining_failure_;
146#define TIMER_SCOPE_NAME2(counter) timer_scope_##counter
147#define TIMER_SCOPE_NAME(counter) TIMER_SCOPE_NAME2(counter)
149#define COMPILER_TIMINGS_TIMER_SCOPE(thread, timer_id) \
150 CompilerTimings::Scope TIMER_SCOPE_NAME(__COUNTER__)( \
151 thread, CompilerTimings::k##timer_id)
153#define COMPILER_TIMINGS_PASS_TIMER_SCOPE(thread, pass_id) \
154 CompilerTimings::Scope TIMER_SCOPE_NAME(__COUNTER__)( \
155 thread, static_cast<CompilerTimings::TimerId>(pass_id))
157#define PRECOMPILER_TIMER_SCOPE(precompiler, timer_id) \
158 CompilerTimings::Scope TIMER_SCOPE_NAME(__COUNTER__)( \
159 (precompiler) -> thread(), CompilerTimings::k##timer_id)
Scope(Thread *thread, TimerId id)
void RecordInliningStatsByOutcome(bool success, const Timer &timer)
ThreadState * thread() const
void AddTotal(const Timer &other)
#define DECLARE_TIMER_ID(Name)
#define COMPILER_TIMERS_LIST(V)