[llvm-commits] CVS: llvm/include/llvm/PassManagers.h
Devang Patel
dpatel at apple.com
Mon Jan 29 12:06:42 PST 2007
Changes in directory llvm/include/llvm:
PassManagers.h updated: 1.4 -> 1.5
---
Log message:
Move TimingInfo into PassManagers.h so that other libs can use it.
---
Diffs of the changes: (+49 -0)
PassManagers.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+)
Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.4 llvm/include/llvm/PassManagers.h:1.5
--- llvm/include/llvm/PassManagers.h:1.4 Mon Jan 15 20:00:38 2007
+++ llvm/include/llvm/PassManagers.h Mon Jan 29 14:06:26 2007
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/PassManager.h"
+#include "llvm/Support/Timer.h"
using namespace llvm;
class llvm::PMDataManager;
@@ -323,5 +324,53 @@
}
};
+//===----------------------------------------------------------------------===//
+// TimingInfo Class - This class is used to calculate information about the
+// amount of time each pass takes to execute. This only happens when
+// -time-passes is enabled on the command line.
+//
+
+class TimingInfo {
+ std::map<Pass*, Timer> TimingData;
+ TimerGroup TG;
+
+public:
+ // Use 'create' member to get this.
+ TimingInfo() : TG("... Pass execution timing report ...") {}
+
+ // TimingDtor - Print out information about timing information
+ ~TimingInfo() {
+ // Delete all of the timers...
+ TimingData.clear();
+ // TimerGroup is deleted next, printing the report.
+ }
+
+ // createTheTimeInfo - This method either initializes the TheTimeInfo pointer
+ // to a non null value (if the -time-passes option is enabled) or it leaves it
+ // null. It may be called multiple times.
+ static void createTheTimeInfo();
+
+ void passStarted(Pass *P) {
+
+ if (dynamic_cast<PMDataManager *>(P))
+ return;
+
+ std::map<Pass*, Timer>::iterator I = TimingData.find(P);
+ if (I == TimingData.end())
+ I=TimingData.insert(std::make_pair(P, Timer(P->getPassName(), TG))).first;
+ I->second.startTimer();
+ }
+ void passEnded(Pass *P) {
+
+ if (dynamic_cast<PMDataManager *>(P))
+ return;
+
+ std::map<Pass*, Timer>::iterator I = TimingData.find(P);
+ assert (I != TimingData.end() && "passStarted/passEnded not nested right!");
+ I->second.stopTimer();
+ }
+};
+
+extern TimingInfo *getTheTimeInfo();
}
More information about the llvm-commits
mailing list