[llvm-commits] CVS: llvm/lib/Support/Timer.cpp
Reid Spencer
reid at x10sys.com
Mon Dec 20 13:44:38 PST 2004
Changes in directory llvm/lib/Support:
Timer.cpp updated: 1.37 -> 1.38
---
Log message:
Fix a bug where system time always equals user time
---
Diffs of the changes: (+12 -5)
Index: llvm/lib/Support/Timer.cpp
diff -u llvm/lib/Support/Timer.cpp:1.37 llvm/lib/Support/Timer.cpp:1.38
--- llvm/lib/Support/Timer.cpp:1.37 Sun Dec 19 21:59:23 2004
+++ llvm/lib/Support/Timer.cpp Mon Dec 20 15:44:27 2004
@@ -105,12 +105,19 @@
sys::TimeValue user(0,0);
sys::TimeValue sys(0,0);
- sys::Process::GetTimeUsage(now,user,sys);
+ long MemUsed = 0;
+ if (Start) {
+ sys::Process::GetTimeUsage(now,user,sys);
+ MemUsed = sys::Process::GetMallocUsage();
+ } else {
+ MemUsed = sys::Process::GetMallocUsage();
+ sys::Process::GetTimeUsage(now,user,sys);
+ }
- Result.Elapsed = now.seconds() + now.microseconds() / 1000000.0;
- Result.UserTime = user.seconds() + user.microseconds() / 1000000.0;
- Result.UserTime = sys.seconds() + sys.microseconds() / 1000000.0;
- Result.MemUsed = sys::Process::GetMallocUsage();
+ Result.Elapsed = now.seconds() + now.microseconds() / 1000000.0;
+ Result.UserTime = user.seconds() + user.microseconds() / 1000000.0;
+ Result.SystemTime = sys.seconds() + sys.microseconds() / 1000000.0;
+ Result.MemUsed = MemUsed;
return Result;
}
More information about the llvm-commits
mailing list