OSDN Git Service

[llvm-mca] Remove unused flag -verbose. NFC
[android-x86/external-llvm.git] / tools / llvm-mca / SummaryView.h
1 //===--------------------- SummaryView.h ---------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 ///
11 /// This file implements the summary view.
12 ///
13 /// The goal of the summary view is to give a very quick overview of the
14 /// performance throughput. Below is an example of summary view:
15 ///
16 ///
17 /// Iterations:     300
18 /// Instructions:   900
19 /// Total Cycles:   610
20 /// Dispatch Width: 2
21 /// IPC:            1.48
22 ///
23 ///
24 /// The summary view collects a few performance numbers. The two main
25 /// performance indicators are 'Total Cycles' and IPC (Instructions Per Cycle).
26 ///
27 //===----------------------------------------------------------------------===//
28
29 #ifndef LLVM_TOOLS_LLVM_MCA_SUMMARYVIEW_H
30 #define LLVM_TOOLS_LLVM_MCA_SUMMARYVIEW_H
31
32 #include "SourceMgr.h"
33 #include "View.h"
34 #include "llvm/Support/raw_ostream.h"
35
36 namespace mca {
37
38 /// \brief A view that collects and prints a few performance numbers.
39 class SummaryView : public View {
40   const SourceMgr &Source;
41   const unsigned DispatchWidth;
42   unsigned TotalCycles;
43
44 public:
45   SummaryView(const SourceMgr &S, unsigned Width)
46       : Source(S), DispatchWidth(Width), TotalCycles(0) {}
47
48   void onCycleEnd() override { ++TotalCycles; }
49
50   void printView(llvm::raw_ostream &OS) const override;
51 };
52 } // namespace mca
53
54 #endif