1 //===--------------------- RetireControlUnitStatistics.h --------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 /// \file 10 /// 11 /// This file defines class RetireControlUnitStatistics: a view that knows how 12 /// to print general statistics related to the retire control unit. 13 /// 14 /// Example: 15 /// ======== 16 /// 17 /// Retire Control Unit - number of cycles where we saw N instructions retired: 18 /// [# retired], [# cycles] 19 /// 0, 109 (17.9%) 20 /// 1, 102 (16.7%) 21 /// 2, 399 (65.4%) 22 /// 23 /// Total ROB Entries: 64 24 /// Max Used ROB Entries: 35 ( 54.7% ) 25 /// Average Used ROB Entries per cy: 32 ( 50.0% ) 26 /// 27 //===----------------------------------------------------------------------===// 28 29 #ifndef LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H 30 #define LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H 31 32 #include "Views/View.h" 33 #include "llvm/MC/MCSchedule.h" 34 #include <map> 35 36 namespace llvm { 37 namespace mca { 38 39 class RetireControlUnitStatistics : public View { 40 using Histogram = std::map<unsigned, unsigned>; 41 Histogram RetiredPerCycle; 42 43 unsigned NumRetired; 44 unsigned NumCycles; 45 unsigned TotalROBEntries; 46 unsigned EntriesInUse; 47 unsigned MaxUsedEntries; 48 unsigned SumOfUsedEntries; 49 50 public: 51 RetireControlUnitStatistics(const MCSchedModel &SM); 52 53 void onEvent(const HWInstructionEvent &Event) override; 54 void onCycleEnd() override; 55 void printView(llvm::raw_ostream &OS) const override; 56 }; 57 58 } // namespace mca 59 } // namespace llvm 60 61 #endif 62