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