1 //===--------------------- DispatchStatistics.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 DispatchStatistics interface.
14 //===----------------------------------------------------------------------===//
16 #include "DispatchStatistics.h"
17 #include "llvm/Support/Format.h"
23 void DispatchStatistics::onEvent(const HWStallEvent &Event) {
24 if (Event.Type < HWStallEvent::LastGenericEvent)
25 HWStalls[Event.Type]++;
28 void DispatchStatistics::onEvent(const HWInstructionEvent &Event) {
29 if (Event.Type == HWInstructionEvent::Dispatched)
33 void DispatchStatistics::printDispatchHistogram(llvm::raw_ostream &OS) const {
35 raw_string_ostream TempStream(Buffer);
36 TempStream << "\n\nDispatch Logic - "
37 << "number of cycles where we saw N instructions dispatched:\n";
38 TempStream << "[# dispatched], [# cycles]\n";
39 for (const std::pair<unsigned, unsigned> &Entry : DispatchGroupSizePerCycle) {
40 TempStream << " " << Entry.first << ", " << Entry.second
42 << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)
50 void DispatchStatistics::printDispatchStalls(raw_ostream &OS) const {
52 raw_string_ostream TempStream(Buffer);
53 TempStream << "\n\nDynamic Dispatch Stall Cycles:\n";
54 TempStream << "RAT - Register unavailable: "
55 << HWStalls[HWStallEvent::RegisterFileStall];
56 TempStream << "\nRCU - Retire tokens unavailable: "
57 << HWStalls[HWStallEvent::RetireControlUnitStall];
58 TempStream << "\nSCHEDQ - Scheduler full: "
59 << HWStalls[HWStallEvent::SchedulerQueueFull];
60 TempStream << "\nLQ - Load queue full: "
61 << HWStalls[HWStallEvent::LoadQueueFull];
62 TempStream << "\nSQ - Store queue full: "
63 << HWStalls[HWStallEvent::StoreQueueFull];
64 TempStream << "\nGROUP - Static restrictions on the dispatch group: "
65 << HWStalls[HWStallEvent::DispatchGroupStall];