Path: blob/main/contrib/llvm-project/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h
35290 views
//===--------------------- RetireControlUnitStatistics.h --------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7/// \file8///9/// This file defines class RetireControlUnitStatistics: a view that knows how10/// to print general statistics related to the retire control unit.11///12/// Example:13/// ========14///15/// Retire Control Unit - number of cycles where we saw N instructions retired:16/// [# retired], [# cycles]17/// 0, 109 (17.9%)18/// 1, 102 (16.7%)19/// 2, 399 (65.4%)20///21/// Total ROB Entries: 6422/// Max Used ROB Entries: 35 ( 54.7% )23/// Average Used ROB Entries per cy: 32 ( 50.0% )24///25//===----------------------------------------------------------------------===//2627#ifndef LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H28#define LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H2930#include "llvm/MC/MCSchedule.h"31#include "llvm/MCA/View.h"32#include <map>3334namespace llvm {35namespace mca {3637class RetireControlUnitStatistics : public View {38using Histogram = std::map<unsigned, unsigned>;39Histogram RetiredPerCycle;4041unsigned NumRetired;42unsigned NumCycles;43unsigned TotalROBEntries;44unsigned EntriesInUse;45unsigned MaxUsedEntries;46unsigned SumOfUsedEntries;4748public:49RetireControlUnitStatistics(const MCSchedModel &SM);5051void onEvent(const HWInstructionEvent &Event) override;52void onCycleEnd() override;53void printView(llvm::raw_ostream &OS) const override;54StringRef getNameAsString() const override {55return "RetireControlUnitStatistics";56}57bool isSerializable() const override { return false; }58};5960} // namespace mca61} // namespace llvm6263#endif646566