//===- bolt/Core/DynoStats.h - Dynamic execution stats ----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Keep track of statistics about the trace of execution captured in BOLT // profile. // //===----------------------------------------------------------------------===// #ifndef BOLT_CORE_DYNO_STATS_H #define BOLT_CORE_DYNO_STATS_H #include "llvm/ADT/ArrayRef.h" #include "llvm/MC/MCInstPrinter.h" #include "llvm/Support/raw_ostream.h" #include <map> #include <unordered_map> namespace llvm { namespace bolt { class BinaryFunction; /// Class encapsulating runtime statistics about an execution unit. class DynoStats { … }; inline raw_ostream &operator<<(raw_ostream &OS, const DynoStats &Stats) { … } DynoStats operator+(const DynoStats &A, const DynoStats &B); /// Return dynostats for the function. /// /// The function relies on branch instructions being in-sync with CFG for /// branch instructions stats. Thus it is better to call it after /// fixBranches(). DynoStats getDynoStats(BinaryFunction &BF); /// Return program-wide dynostats. template <typename FuncsType> inline DynoStats getDynoStats(FuncsType &Funcs, bool IsAArch64) { … } /// Call a function with optional before and after dynostats printing. template <typename FnType, typename FuncsType> inline void callWithDynoStats(raw_ostream &OS, FnType &&Func, FuncsType &Funcs, StringRef Phase, const bool Flag, bool IsAArch64) { … } } // namespace bolt } // namespace llvm #endif