10#define DEFINE_NAME(Name) #Name,
16void CompilerTimings::PrintTimers(
18 const std::unique_ptr<CompilerTimings::Timers>& timers,
21 const int64_t total_elapsed = total.TotalElapsedTime();
23 int64_t total_accounted = 0;
24 int64_t total_accounted_cpu = 0;
25 for (intptr_t
i = 0;
i < kNumTimers;
i++) {
26 const auto& entry = timers->timers_[
i];
27 total_accounted += entry.TotalElapsedTime();
28 total_accounted_cpu += entry.TotalElapsedTimeCpu();
34 const double kMinInterestingSelfPercent = 1.0;
35 const double kMaxInterestingSelfPercent = 99.0;
37 const int64_t
self = total_elapsed - total_accounted;
40 if (kMinInterestingSelfPercent < self_pct &&
41 self_pct < kMaxInterestingSelfPercent) {
42 const int64_t self_cpu =
43 total.TotalElapsedTimeCpu() - total_accounted_cpu;
44 const auto self_timer = Timer(
self, self_cpu);
46 self_timer.FormatElapsedHumanReadable(zone));
53 Timer* by_elapsed[kNumTimers];
54 for (intptr_t
i = 0;
i < kNumTimers;
i++) {
55 by_elapsed[
i] = &timers->timers_[
i];
57 qsort(by_elapsed, kNumTimers,
sizeof(Timer*),
58 [](
const void* pa,
const void* pb) ->
int {
59 const auto a_elapsed =
60 (*
static_cast<Timer* const*
>(pa))->TotalElapsedTime();
61 const auto b_elapsed =
62 (*
static_cast<Timer* const*
>(pb))->TotalElapsedTime();
63 return b_elapsed < a_elapsed ? -1 : b_elapsed > a_elapsed ? 1 : 0;
67 for (intptr_t
i = 0;
i < kNumTimers;
i++) {
68 auto timer = by_elapsed[
i];
69 if (timer->TotalElapsedTime() > 0) {
70 const auto timer_id =
static_cast<TimerId>(timer - &timers->timers_[0]);
72 static_cast<double>(timer->TotalElapsedTime()) * 100 / total_elapsed;
74 const int indent =
static_cast<int>(
level * 2);
78 "%*s[%6.2f%%] %-*s %-10s", indent,
"", pct, 60 - indent,
79 timer_names[timer_id],
81 timer->TotalElapsedTimeCpu()));
84 if (timers->nested_[timer_id] !=
nullptr) {
85 PrintTimers(zone, timers->nested_[timer_id], *timer,
level + 1);
99 PrintTimers(zone, root_, total_, 0);
101 OS::PrintErr(
"Inlining by outcome\n Success: %s\n Failure: %s\n",
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Thread * Current()
const char * FormatElapsedHumanReadable(Zone *zone) const
#define DEFINE_NAME(Name)
#define COMPILER_TIMERS_LIST(V)