summaryrefslogtreecommitdiff
path: root/include/Support/Statistic.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-01 22:35:45 +0000
committerChris Lattner <sabre@nondot.org>2002-10-01 22:35:45 +0000
commit96ef1b90c8f3a6649993bb7ab10db3510f12e80a (patch)
treeb8d3eb6f8b78ede48cdbe9ca27aef34aed26112e /include/Support/Statistic.h
parent11aec6cc7d2f1705d410df6ee25555f2d7101f30 (diff)
downloadllvm-96ef1b90c8f3a6649993bb7ab10db3510f12e80a.tar.gz
llvm-96ef1b90c8f3a6649993bb7ab10db3510f12e80a.tar.bz2
llvm-96ef1b90c8f3a6649993bb7ab10db3510f12e80a.tar.xz
- 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/Support/Statistic.h')
-rw-r--r--include/Support/Statistic.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/Support/Statistic.h b/include/Support/Statistic.h
index 8f6ed79da8..62dec92bc4 100644
--- a/include/Support/Statistic.h
+++ b/include/Support/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(); }