Fix a bug where system time always equals user time

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19075 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-12-20 21:44:27 +00:00
parent 8b6628997f
commit 7d05563324

View File

@ -105,12 +105,19 @@ static TimeRecord getTimeRecord(bool Start) {
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;
}