diff options
Diffstat (limited to 'llvm/tools/llvm-mca/Views/SummaryView.cpp')
| -rw-r--r-- | llvm/tools/llvm-mca/Views/SummaryView.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/tools/llvm-mca/Views/SummaryView.cpp b/llvm/tools/llvm-mca/Views/SummaryView.cpp index 8d529ba1549..a509818e6d7 100644 --- a/llvm/tools/llvm-mca/Views/SummaryView.cpp +++ b/llvm/tools/llvm-mca/Views/SummaryView.cpp @@ -24,14 +24,18 @@ namespace mca { using namespace llvm; -SummaryView::SummaryView(const MCSchedModel &Model, const SourceMgr &S, +SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef<MCInst> S, unsigned Width) : SM(Model), Source(S), DispatchWidth(Width), TotalCycles(0), - NumMicroOps(0), ProcResourceUsage(Model.getNumProcResourceKinds(), 0) { + LastInstructionIdx(0), NumMicroOps(0), + ProcResourceUsage(Model.getNumProcResourceKinds(), 0) { computeProcResourceMasks(SM, ProcResourceMasks); } void SummaryView::onEvent(const HWInstructionEvent &Event) { + if (Event.Type == HWInstructionEvent::Dispatched) + LastInstructionIdx = Event.IR.getSourceIndex(); + // We are only interested in the "instruction retired" events generated by // the retire stage for instructions that are part of iteration #0. if (Event.Type != HWInstructionEvent::Retired || @@ -57,8 +61,8 @@ void SummaryView::onEvent(const HWInstructionEvent &Event) { } void SummaryView::printView(raw_ostream &OS) const { - unsigned Iterations = Source.getNumIterations(); unsigned Instructions = Source.size(); + unsigned Iterations = (LastInstructionIdx / Instructions) + 1; unsigned TotalInstructions = Instructions * Iterations; unsigned TotalUOps = NumMicroOps * Iterations; double IPC = (double)TotalInstructions / TotalCycles; |

