mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
9919114951
Summary: This patch eliminates some redundancy in iterating across Listeners for the Instruction and Stall HWEvents, by introducing a template onEvent routine. This change was suggested by @courbet in https://reviews.llvm.org/D48576. I hope that this patch addresses that suggestion appropriately. I do like this change better than what we had previously. Reviewers: andreadb, courbet, RKSimon Reviewed By: andreadb, courbet Subscribers: javed.absar, tschuett, gbedwell, llvm-commits, courbet Differential Revision: https://reviews.llvm.org/D48672 llvm-svn: 336916
72 lines
2.5 KiB
C++
72 lines
2.5 KiB
C++
//===--------------------- DispatchStatistics.cpp ---------------------*- C++
|
|
//-*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
/// \file
|
|
///
|
|
/// This file implements the DispatchStatistics interface.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "DispatchStatistics.h"
|
|
#include "llvm/Support/Format.h"
|
|
|
|
using namespace llvm;
|
|
|
|
namespace mca {
|
|
|
|
void DispatchStatistics::onEvent(const HWStallEvent &Event) {
|
|
if (Event.Type < HWStallEvent::LastGenericEvent)
|
|
HWStalls[Event.Type]++;
|
|
}
|
|
|
|
void DispatchStatistics::onEvent(const HWInstructionEvent &Event) {
|
|
if (Event.Type == HWInstructionEvent::Dispatched)
|
|
++NumDispatched;
|
|
}
|
|
|
|
void DispatchStatistics::printDispatchHistogram(llvm::raw_ostream &OS) const {
|
|
std::string Buffer;
|
|
raw_string_ostream TempStream(Buffer);
|
|
TempStream << "\n\nDispatch Logic - "
|
|
<< "number of cycles where we saw N instructions dispatched:\n";
|
|
TempStream << "[# dispatched], [# cycles]\n";
|
|
for (const std::pair<unsigned, unsigned> &Entry : DispatchGroupSizePerCycle) {
|
|
TempStream << " " << Entry.first << ", " << Entry.second
|
|
<< " ("
|
|
<< format("%.1f", ((double)Entry.second / NumCycles) * 100.0)
|
|
<< "%)\n";
|
|
}
|
|
|
|
TempStream.flush();
|
|
OS << Buffer;
|
|
}
|
|
|
|
void DispatchStatistics::printDispatchStalls(raw_ostream &OS) const {
|
|
std::string Buffer;
|
|
raw_string_ostream TempStream(Buffer);
|
|
TempStream << "\n\nDynamic Dispatch Stall Cycles:\n";
|
|
TempStream << "RAT - Register unavailable: "
|
|
<< HWStalls[HWStallEvent::RegisterFileStall];
|
|
TempStream << "\nRCU - Retire tokens unavailable: "
|
|
<< HWStalls[HWStallEvent::RetireControlUnitStall];
|
|
TempStream << "\nSCHEDQ - Scheduler full: "
|
|
<< HWStalls[HWStallEvent::SchedulerQueueFull];
|
|
TempStream << "\nLQ - Load queue full: "
|
|
<< HWStalls[HWStallEvent::LoadQueueFull];
|
|
TempStream << "\nSQ - Store queue full: "
|
|
<< HWStalls[HWStallEvent::StoreQueueFull];
|
|
TempStream << "\nGROUP - Static restrictions on the dispatch group: "
|
|
<< HWStalls[HWStallEvent::DispatchGroupStall];
|
|
TempStream << '\n';
|
|
TempStream.flush();
|
|
OS << Buffer;
|
|
}
|
|
|
|
} // namespace mca
|