[llvm-commits] CVS: llvm/lib/Support/Timer.cpp
Reid Spencer
reid at x10sys.com
Mon Dec 27 00:03:16 PST 2004
Changes in directory llvm/lib/Support:
Timer.cpp updated: 1.38 -> 1.39
---
Log message:
Fix a bug that made the nightly tester *really* slow. During changes for
portability, the --track-space option was inadvertently ignored. This patch
fixes that so that sys::Process::GetMallocUsage() is only invoked if the
--track-spaces option is given. Apparently the mallinfo() call that
GetMallocUsage() uses is *very* slow, especially when processing very large
modules like projects/llvm-test/MultiSource/Applications/kimwitu++.
---
Diffs of the changes: (+9 -3)
Index: llvm/lib/Support/Timer.cpp
diff -u llvm/lib/Support/Timer.cpp:1.38 llvm/lib/Support/Timer.cpp:1.39
--- llvm/lib/Support/Timer.cpp:1.38 Mon Dec 20 15:44:27 2004
+++ llvm/lib/Support/Timer.cpp Mon Dec 27 02:03:04 2004
@@ -93,6 +93,12 @@
}
}
+static inline long getMemUsage() {
+ if (TrackSpace)
+ return sys::Process::GetMallocUsage();
+ return 0;
+}
+
struct TimeRecord {
double Elapsed, UserTime, SystemTime;
long MemUsed;
@@ -108,9 +114,9 @@
long MemUsed = 0;
if (Start) {
sys::Process::GetTimeUsage(now,user,sys);
- MemUsed = sys::Process::GetMallocUsage();
+ MemUsed = getMemUsage();
} else {
- MemUsed = sys::Process::GetMallocUsage();
+ MemUsed = getMemUsage();
sys::Process::GetTimeUsage(now,user,sys);
}
@@ -165,7 +171,7 @@
/// currently active timers, which will be printed when the timer group prints
///
void Timer::addPeakMemoryMeasurement() {
- long MemUsed = sys::Process::GetMallocUsage();
+ long MemUsed = getMemUsage();
for (std::vector<Timer*>::iterator I = ActiveTimers.begin(),
E = ActiveTimers.end(); I != E; ++I)
More information about the llvm-commits
mailing list