1 //===--------------------- RetireControlUnitStatistics.cpp ------*- 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 implements the RetireControlUnitStatistics interface.
13 //===----------------------------------------------------------------------===//
15 #include "RetireControlUnitStatistics.h"
16 #include "llvm/Support/Format.h"
22 void RetireControlUnitStatistics::onEvent(const HWInstructionEvent &Event) {
23 if (Event.Type == HWInstructionEvent::Retired)
27 void RetireControlUnitStatistics::printView(llvm::raw_ostream &OS) const {
29 raw_string_ostream TempStream(Buffer);
30 TempStream << "\n\nRetire Control Unit - "
31 << "number of cycles where we saw N instructions retired:\n";
32 TempStream << "[# retired], [# cycles]\n";
34 for (const std::pair<unsigned, unsigned> &Entry : RetiredPerCycle) {
35 TempStream << " " << Entry.first;
40 TempStream << Entry.second << " ("
41 << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)