1 //===--------------------- RetireControlUnitStatistics.cpp ---------------*- C++
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
12 /// This file implements the RetireControlUnitStatistics interface.
14 //===----------------------------------------------------------------------===//
16 #include "RetireControlUnitStatistics.h"
17 #include "llvm/Support/Format.h"
23 void RetireControlUnitStatistics::onInstructionEvent(
24 const HWInstructionEvent &Event) {
25 if (Event.Type == HWInstructionEvent::Retired)
29 void RetireControlUnitStatistics::printView(llvm::raw_ostream &OS) const {
31 raw_string_ostream TempStream(Buffer);
32 TempStream << "\n\nRetire Control Unit - "
33 << "number of cycles where we saw N instructions retired:\n";
34 TempStream << "[# retired], [# cycles]\n";
36 for (const std::pair<unsigned, unsigned> &Entry : RetiredPerCycle) {
37 TempStream << " " << Entry.first;
42 TempStream << Entry.second << " ("
43 << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)