diff options
author | Pavel Labath <labath@google.com> | 2016-10-24 10:59:17 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2016-10-24 10:59:17 +0000 |
commit | 757ca886cd224726d43333d44b5b2ce0989b7f1c (patch) | |
tree | d7416c65b01b7532a708d98fa3ac7a3b2dcab1ce /llvm/lib/Support/Windows/Process.inc | |
parent | 407fd070b776b2c600d53ebb83cb1f4291496606 (diff) | |
download | bcm5719-llvm-757ca886cd224726d43333d44b5b2ce0989b7f1c.tar.gz bcm5719-llvm-757ca886cd224726d43333d44b5b2ce0989b7f1c.zip |
Remove TimeValue usage from llvm/Support
Summary:
This is a follow-up to D25416. It removes all usages of TimeValue from
llvm/Support library (except for the actual TimeValue declaration), and replaces
them with appropriate usages of std::chrono. To facilitate this, I have added
small utility functions for converting time points and durations into appropriate
OS-specific types (FILETIME, struct timespec, ...).
Reviewers: zturner, mehdi_amini
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D25730
llvm-svn: 284966
Diffstat (limited to 'llvm/lib/Support/Windows/Process.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Process.inc | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc index b012991c2a5..8d646b3217a 100644 --- a/llvm/lib/Support/Windows/Process.inc +++ b/llvm/lib/Support/Windows/Process.inc @@ -49,18 +49,6 @@ using namespace llvm; using namespace sys; -static TimeValue getTimeValueFromFILETIME(FILETIME Time) { - ULARGE_INTEGER TimeInteger; - TimeInteger.LowPart = Time.dwLowDateTime; - TimeInteger.HighPart = Time.dwHighDateTime; - - // FILETIME's are # of 100 nanosecond ticks (1/10th of a microsecond) - return TimeValue( - static_cast<TimeValue::SecondsType>(TimeInteger.QuadPart / 10000000), - static_cast<TimeValue::NanoSecondsType>( - (TimeInteger.QuadPart % 10000000) * 100)); -} - // This function retrieves the page size using GetNativeSystemInfo() and is // present solely so it can be called once to initialize the self_process member // below. @@ -93,17 +81,17 @@ Process::GetMallocUsage() return size; } -void Process::GetTimeUsage(TimeValue &elapsed, TimeValue &user_time, - TimeValue &sys_time) { - elapsed = TimeValue::now(); +void Process::GetTimeUsage(TimePoint<> &elapsed, std::chrono::nanoseconds &user_time, + std::chrono::nanoseconds &sys_time) { + elapsed = std::chrono::system_clock::now();; FILETIME ProcCreate, ProcExit, KernelTime, UserTime; if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime, &UserTime) == 0) return; - user_time = getTimeValueFromFILETIME(UserTime); - sys_time = getTimeValueFromFILETIME(KernelTime); + user_time = toDuration(UserTime); + sys_time = toDuration(KernelTime); } // Some LLVM programs such as bugpoint produce core files as a normal part of |