[llvm-commits] CVS: llvm/include/Support/Timer.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Nov 18 15:47:01 PST 2002
Changes in directory llvm/include/Support:
Timer.h updated: 1.3 -> 1.4
---
Log message:
Add facility to compute peak memory usage
---
Diffs of the changes:
Index: llvm/include/Support/Timer.h
diff -u llvm/include/Support/Timer.h:1.3 llvm/include/Support/Timer.h:1.4
--- llvm/include/Support/Timer.h:1.3 Mon Nov 4 13:20:09 2002
+++ llvm/include/Support/Timer.h Mon Nov 18 15:45:55 2002
@@ -35,6 +35,8 @@
double UserTime; // User time elapsed
double SystemTime; // System time elapsed
long MemUsed; // Memory allocated (in bytes)
+ long PeakMem; // Peak memory used
+ long PeakMemBase; // Temporary for peak calculation...
std::string Name; // The name of this time variable
bool Started; // Has this time variable ever been started?
TimerGroup *TG; // The TimerGroup this Timer is in.
@@ -47,6 +49,7 @@
double getProcessTime() const { return UserTime+SystemTime; }
double getWallTime() const { return Elapsed; }
long getMemUsed() const { return MemUsed; }
+ long getPeakMem() const { return PeakMem; }
std::string getName() const { return Name; }
const Timer &operator=(const Timer &T) {
@@ -54,6 +57,8 @@
UserTime = T.UserTime;
SystemTime = T.SystemTime;
MemUsed = T.MemUsed;
+ PeakMem = T.PeakMem;
+ PeakMemBase = T.PeakMemBase;
Name = T.Name;
Started = T.Started;
assert (TG == T.TG && "Can only assign timers in the same TimerGroup!");
@@ -76,6 +81,12 @@
/// stopTimer - Stop the timer.
///
void stopTimer();
+
+ /// addPeakMemoryMeasurement - This method should be called whenever memory
+ /// usage needs to be checked. It adds a peak memory measurement to the
+ /// currently active timers, which will be printed when the timer group prints
+ ///
+ static void addPeakMemoryMeasurement();
/// print - Print the current timer to standard error, and reset the "Started"
/// flag.
More information about the llvm-commits
mailing list