1 //===--------------------- RetireControlUnitStatistics.h --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file defines class RetireControlUnitStatistics: a view that knows how
12 /// to print general statistics related to the retire control unit.
17 /// Retire Control Unit - number of cycles where we saw N instructions retired:
18 /// [# retired], [# cycles]
24 //===----------------------------------------------------------------------===//
26 #ifndef LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H
27 #define LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H
30 #include "llvm/MC/MCSubtargetInfo.h"
35 class RetireControlUnitStatistics : public View {
36 using Histogram = std::map<unsigned, unsigned>;
37 Histogram RetiredPerCycle;
42 void updateHistograms() {
43 RetiredPerCycle[NumRetired]++;
48 RetireControlUnitStatistics() : NumRetired(0), NumCycles(0) {}
50 void onEvent(const HWInstructionEvent &Event) override;
52 void onCycleBegin() override { NumCycles++; }
54 void onCycleEnd() override { updateHistograms(); }
56 void printView(llvm::raw_ostream &OS) const override;