diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-01 22:35:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-01 22:35:45 +0000 |
commit | 96ef1b90c8f3a6649993bb7ab10db3510f12e80a (patch) | |
tree | b8d3eb6f8b78ede48cdbe9ca27aef34aed26112e /include/llvm/ADT | |
parent | 11aec6cc7d2f1705d410df6ee25555f2d7101f30 (diff) | |
download | external_llvm-96ef1b90c8f3a6649993bb7ab10db3510f12e80a.zip external_llvm-96ef1b90c8f3a6649993bb7ab10db3510f12e80a.tar.gz external_llvm-96ef1b90c8f3a6649993bb7ab10db3510f12e80a.tar.bz2 |
- Rework Statistics:
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
* Broke constructor to take two const char * arguments instead of one, so
that indendation can be taken care of automatically.
* Sort the list by pass name when printing
* Make sure to print all statistics as a group, instead of randomly when
the statistics dtors are called.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/Statistic.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/llvm/ADT/Statistic.h b/include/llvm/ADT/Statistic.h index 8f6ed79..62dec92 100644 --- a/include/llvm/ADT/Statistic.h +++ b/include/llvm/ADT/Statistic.h @@ -1,4 +1,4 @@ -//===-- Support/StatisticReporter.h - Easy way to expose stats ---*- C++ -*-==// +//===-- Support/Statistic.h - Easy way to expose stats ----------*- C++ -*-===// // // This file defines the 'Statistic' class, which is designed to be an easy way // to expose various success metrics from passes. These statistics are printed @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#ifndef SUPPORT_STATISTIC_REPORTER_H -#define SUPPORT_STATISTIC_REPORTER_H +#ifndef SUPPORT_STATISTIC_H +#define SUPPORT_STATISTIC_H #include <iosfwd> @@ -43,8 +43,12 @@ extern bool DebugFlag; // StatisticBase - Nontemplated base class for Statistic<> class... class StatisticBase { const char *Name; + const char *Desc; + static unsigned NumStats; protected: - StatisticBase(const char *name) : Name(name) {} + StatisticBase(const char *name, const char *desc) : Name(name), Desc(desc) { + ++NumStats; // Keep track of how many stats are created... + } virtual ~StatisticBase() {} // destroy - Called by subclass dtor so that we can still invoke virtual @@ -69,11 +73,12 @@ class Statistic : private StatisticBase { virtual bool hasSomeData() const { return Value != DataType(); } public: // Normal constructor, default initialize data item... - Statistic(const char *name) : StatisticBase(name), Value(DataType()) {} + Statistic(const char *name, const char *desc) + : StatisticBase(name, desc), Value(DataType()) {} // Constructor to provide an initial value... - Statistic(const DataType &Val, const char *name) - : StatisticBase(name), Value(Val) {} + Statistic(const DataType &Val, const char *name, const char *desc) + : StatisticBase(name, desc), Value(Val) {} // Print information when destroyed, iff command line option is specified ~Statistic() { destroy(); } |