summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-27 08:03:04 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-27 08:03:04 +0000
commitad7bdf7400adc9293a2309e12fefd3a0a68da954 (patch)
tree2ad4e349801423cd93f5c28a9258ac03c98f78a0 /llvm/lib/Support
parenta079b69981a1635e9aae414942a86f568d0d0d4b (diff)
downloadbcm5719-llvm-ad7bdf7400adc9293a2309e12fefd3a0a68da954.tar.gz
bcm5719-llvm-ad7bdf7400adc9293a2309e12fefd3a0a68da954.zip
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++. llvm-svn: 19163
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Timer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index 47d696804a7..4b273b02ff9 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -93,6 +93,12 @@ Timer::~Timer() {
}
}
+static inline long getMemUsage() {
+ if (TrackSpace)
+ return sys::Process::GetMallocUsage();
+ return 0;
+}
+
struct TimeRecord {
double Elapsed, UserTime, SystemTime;
long MemUsed;
@@ -108,9 +114,9 @@ static TimeRecord getTimeRecord(bool Start) {
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 @@ void Timer::sum(const Timer &T) {
/// 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)
OpenPOWER on IntegriCloud