mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
Implement GetTimeUsage correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5d282185f5
commit
8b6628997f
@ -92,10 +92,14 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time,
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
struct rusage usage;
|
||||
::getrusage(RUSAGE_SELF, &usage);
|
||||
user_time.seconds( usage.ru_utime.tv_sec );
|
||||
user_time.microseconds( usage.ru_utime.tv_usec );
|
||||
sys_time.seconds( usage.ru_stime.tv_sec );
|
||||
sys_time.microseconds( usage.ru_stime.tv_usec );
|
||||
user_time = TimeValue(
|
||||
static_cast<TimeValue::SecondsType>( usage.ru_utime.tv_sec ),
|
||||
static_cast<TimeValue::NanoSecondsType>( usage.ru_utime.tv_usec *
|
||||
TimeValue::NANOSECONDS_PER_MICROSECOND ) );
|
||||
sys_time = TimeValue(
|
||||
static_cast<TimeValue::SecondsType>( usage.ru_stime.tv_sec ),
|
||||
static_cast<TimeValue::NanoSecondsType>( usage.ru_stime.tv_usec *
|
||||
TimeValue::NANOSECONDS_PER_MICROSECOND ) );
|
||||
#else
|
||||
#warning Cannot get usage times on this platform
|
||||
user_time.seconds(0);
|
||||
|
@ -92,10 +92,14 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time,
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
struct rusage usage;
|
||||
::getrusage(RUSAGE_SELF, &usage);
|
||||
user_time.seconds( usage.ru_utime.tv_sec );
|
||||
user_time.microseconds( usage.ru_utime.tv_usec );
|
||||
sys_time.seconds( usage.ru_stime.tv_sec );
|
||||
sys_time.microseconds( usage.ru_stime.tv_usec );
|
||||
user_time = TimeValue(
|
||||
static_cast<TimeValue::SecondsType>( usage.ru_utime.tv_sec ),
|
||||
static_cast<TimeValue::NanoSecondsType>( usage.ru_utime.tv_usec *
|
||||
TimeValue::NANOSECONDS_PER_MICROSECOND ) );
|
||||
sys_time = TimeValue(
|
||||
static_cast<TimeValue::SecondsType>( usage.ru_stime.tv_sec ),
|
||||
static_cast<TimeValue::NanoSecondsType>( usage.ru_stime.tv_usec *
|
||||
TimeValue::NANOSECONDS_PER_MICROSECOND ) );
|
||||
#else
|
||||
#warning Cannot get usage times on this platform
|
||||
user_time.seconds(0);
|
||||
|
Loading…
Reference in New Issue
Block a user