From 0184a841d3914bb78c7c6fa87ce9da86a2d5992a Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 31 Dec 2012 11:17:50 +0000 Subject: Begin sketching out the process interface. The coding style used here is not LLVM's style because this is modeled after a Boost interface and thus done in the style of a candidate C++ standard library interface. I'll probably end up proposing it as a standard C++ library if it proves to be reasonably portable and useful. This is just the most basic parts of the interface -- getting the process ID out of it. However, it helps sketch out some of the boiler plate such as the base class, derived class, shared code, and static factory function. It also introduces a unittest so that I can incrementally ensure this stuff works. However, I've not even compiled this code for Windows yet. I'll try to fix any Windows fallout from the bots, and if I can't fix it I'll revert and get someone on Windows to help out. There isn't a lot more that is mandatory, so soon I'll switch to just stubbing out the Windows side and get Michael Spencer to help with implementation as he can test it directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171289 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Support/ProcessTest.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 unittests/Support/ProcessTest.cpp (limited to 'unittests/Support/ProcessTest.cpp') diff --git a/unittests/Support/ProcessTest.cpp b/unittests/Support/ProcessTest.cpp new file mode 100644 index 0000000000..d4c4b54ccc --- /dev/null +++ b/unittests/Support/ProcessTest.cpp @@ -0,0 +1,33 @@ +//===- unittest/Support/ProcessTest.cpp -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/Process.h" +#include "gtest/gtest.h" + +#ifdef LLVM_ON_WIN32 +#include "windows.h" +#endif + +namespace { + +using namespace llvm; +using namespace sys; + +TEST(ProcessTest, SelfProcess) { + EXPECT_TRUE(process::get_self()); + EXPECT_EQ(process::get_self(), process::get_self()); + +#if defined(LLVM_ON_UNIX) + EXPECT_EQ(getpid(), process::get_self()->get_id()); +#elif defined(LLVM_ON_WIN32) + EXPECT_EQ(GetCurrentProcess(), process::get_self()->get_id()); +#endif +} + +} // end anonymous namespace -- cgit v1.2.3-70-g09d2 From 814afe91ccad0e5e1f767303d780fa0318fa5212 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 31 Dec 2012 23:23:35 +0000 Subject: Flesh out a page size accessor in the new API. Implement the old API in terms of the new one. This simplifies the implementation on Windows which can now re-use the self_process's once initialization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171330 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Process.h | 20 ++++++++++++++++++++ lib/Support/Process.cpp | 8 ++++++++ lib/Support/Unix/Process.inc | 11 +++++++---- lib/Support/Windows/Process.inc | 14 ++++++-------- unittests/Support/ProcessTest.cpp | 2 ++ 5 files changed, 43 insertions(+), 12 deletions(-) (limited to 'unittests/Support/ProcessTest.cpp') diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h index 6b29f57fc1..15fa3763c9 100644 --- a/include/llvm/Support/Process.h +++ b/include/llvm/Support/Process.h @@ -89,7 +89,27 @@ class self_process : public process { public: virtual id_type get_id(); + /// \name Process configuration (sysconf on POSIX) + /// @{ + + /// \brief Get the virtual memory page size. + /// + /// Query the operating system for this process's page size. + size_t page_size() const { return PageSize; }; + + /// @} + private: + /// \name Cached process state. + /// @{ + + /// \brief Cached page size, this cannot vary during the life of the process. + size_t PageSize; + + /// @} + + /// \brief Constructor, used by \c process::get_self() only. + self_process(); }; diff --git a/lib/Support/Process.cpp b/lib/Support/Process.cpp index 1e21d64e60..9d87b7744b 100644 --- a/lib/Support/Process.cpp +++ b/lib/Support/Process.cpp @@ -55,6 +55,14 @@ self_process::~self_process() { #endif +//===----------------------------------------------------------------------===// +// Implementations of legacy functions in terms of the new self_process object. + +unsigned Process::GetPageSize() { + return process::get_self()->page_size(); +} + + // Include the platform-specific parts of this class. #ifdef LLVM_ON_UNIX #include "Unix/Process.inc" diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index e96d37ce56..9ad6272bab 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -49,10 +49,7 @@ process::id_type self_process::get_id() { return getpid(); } - -unsigned -Process::GetPageSize() -{ +static unsigned getPageSize() { #if defined(__CYGWIN__) // On Cygwin, getpagesize() returns 64k but the page size for the purposes of // memory protection and mmap() is 4k. @@ -68,6 +65,12 @@ Process::GetPageSize() return static_cast(page_size); } +// This constructor guaranteed to be run exactly once on a single thread, and +// sets up various process invariants that can be queried cheaply from then on. +self_process::self_process() : PageSize(getPageSize()) { +} + + size_t Process::GetMallocUsage() { #if defined(HAVE_MALLINFO) struct mallinfo mi; diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index d3a0c94e1c..9eb611be87 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -43,11 +43,9 @@ process::id_type self_process::get_id() { return GetCurrentProcess(); } - // This function retrieves the page size using GetSystemInfo and is present -// solely so it can be called once in Process::GetPageSize to initialize the -// static variable PageSize. -inline unsigned GetPageSizeOnce() { +// solely so it can be called once to initialize the self_process member below. +static unsigned getPageSize() { // NOTE: A 32-bit application running under WOW64 is supposed to use // GetNativeSystemInfo. However, this interface is not present prior // to Windows XP so to use it requires dynamic linking. It is not clear @@ -58,12 +56,12 @@ inline unsigned GetPageSizeOnce() { return static_cast(info.dwPageSize); } -unsigned -Process::GetPageSize() { - static const unsigned PageSize = GetPageSizeOnce(); - return PageSize; +// This constructor guaranteed to be run exactly once on a single thread, and +// sets up various process invariants that can be queried cheaply from then on. +self_process::self_process() : PageSize(getPageSize()) { } + size_t Process::GetMallocUsage() { diff --git a/unittests/Support/ProcessTest.cpp b/unittests/Support/ProcessTest.cpp index d4c4b54ccc..58a7c4acaa 100644 --- a/unittests/Support/ProcessTest.cpp +++ b/unittests/Support/ProcessTest.cpp @@ -28,6 +28,8 @@ TEST(ProcessTest, SelfProcess) { #elif defined(LLVM_ON_WIN32) EXPECT_EQ(GetCurrentProcess(), process::get_self()->get_id()); #endif + + EXPECT_LT(1u, process::get_self()->page_size()); } } // end anonymous namespace -- cgit v1.2.3-70-g09d2 From 73c35d86b9d5236be5b3f49bc8df11008b96636e Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 4 Jan 2013 23:19:55 +0000 Subject: Add time getters to the process interface for requesting the elapsed wall time, user time, and system time since a process started. For walltime, we currently use TimeValue's interface and a global initializer to compute a close approximation of total process runtime. For user time, this adds support for an somewhat more precise timing mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock selected. For system time, we have to do a full getrusage call to extract the system time from the OS. This is expensive but unavoidable. In passing, clean up the implementation of the old APIs and fix some latent bugs in the Windows code. This might have manifested on Windows ARM systems or other systems with strange 64-bit integer behavior. The old API for this both user time and system time simultaneously from a single getrusage call. While this results in fewer system calls, it also results in a lower precision user time and if only user time is desired, it introduces a higher overhead. It may be worthwhile to switch some of the pass timers to not track system time and directly track user and wall time. The old API also tracked walltime in a confusing way -- it just set it to the current walltime rather than providing any measure of wall time since the process started the way buth user and system time are tracked. The new API is more consistent here. The plan is to eventually implement these methods for a *child* process by using the wait3(2) system call to populate an rusage struct representing the whole subprocess execution. That way, after waiting on a child process its stats will become accurate and cheap to query. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171551 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/configure.ac | 4 ++ cmake/config-ix.cmake | 1 + cmake/modules/LLVM-Config.cmake | 7 ++- configure | 104 ++++++++++++++++++++++++++++++++++++++ include/llvm/Support/Process.h | 20 ++++++++ lib/Support/Process.cpp | 25 +++++++++ lib/Support/Unix/Process.inc | 62 +++++++++++++++-------- lib/Support/Windows/Process.inc | 51 ++++++++++++++----- unittests/Support/ProcessTest.cpp | 7 +++ 9 files changed, 244 insertions(+), 37 deletions(-) (limited to 'unittests/Support/ProcessTest.cpp') diff --git a/autoconf/configure.ac b/autoconf/configure.ac index c5ac14999f..fdda3f9567 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1250,6 +1250,10 @@ AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1], [Define if dlopen() is available on this platform.]), AC_MSG_WARN([dlopen() not found - disabling plugin support])) +dnl clock_gettime() is required for modern timing support. +AC_SEARCH_LIBS(clock_gettime,rt,[], + AC_MSG_ERROR([clock_gettime not found and is required for modern POSIX timing uspport])) + dnl libffi is optional; used to call external functions from the interpreter if test "$llvm_cv_enable_libffi" = "yes" ; then AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1], diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 274de31c9e..c625b871e4 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -99,6 +99,7 @@ if( NOT PURE_WINDOWS ) endif() endif() check_library_exists(dl dlopen "" HAVE_LIBDL) + check_library_exists(rt clock_gettime "" HAVE_LIBRT) endif() # function checks diff --git a/cmake/modules/LLVM-Config.cmake b/cmake/modules/LLVM-Config.cmake index 574335c49d..163401c857 100755 --- a/cmake/modules/LLVM-Config.cmake +++ b/cmake/modules/LLVM-Config.cmake @@ -4,11 +4,14 @@ function(get_system_libs return_var) if( MINGW ) set(system_libs ${system_libs} imagehlp psapi) elseif( CMAKE_HOST_UNIX ) + if( HAVE_LIBRT ) + set(system_libs ${system_libs} rt) + endif() if( HAVE_LIBDL ) - set(system_libs ${system_libs} ${CMAKE_DL_LIBS}) + set(system_libs ${system_libs} ${CMAKE_DL_LIBS}) endif() if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD ) - set(system_libs ${system_libs} pthread) + set(system_libs ${system_libs} pthread) endif() endif( MINGW ) endif( NOT MSVC ) diff --git a/configure b/configure index e466dd67ca..8e06154b98 100755 --- a/configure +++ b/configure @@ -12517,6 +12517,110 @@ echo "$as_me: WARNING: dlopen() not found - disabling plugin support" >&2;} fi +{ echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5 +echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6; } +if test "${ac_cv_search_clock_gettime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_clock_gettime=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_clock_gettime+set}" = set; then + break +fi +done +if test "${ac_cv_search_clock_gettime+set}" = set; then + : +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5 +echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else + { { echo "$as_me:$LINENO: error: clock_gettime not found and is required for modern POSIX timing uspport" >&5 +echo "$as_me: error: clock_gettime not found and is required for modern POSIX timing uspport" >&2;} + { (exit 1); exit 1; }; } +fi + + if test "$llvm_cv_enable_libffi" = "yes" ; then { echo "$as_me:$LINENO: checking for library containing ffi_call" >&5 echo $ECHO_N "checking for library containing ffi_call... $ECHO_C" >&6; } diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h index f149a4e058..ea8da6d4c5 100644 --- a/include/llvm/Support/Process.h +++ b/include/llvm/Support/Process.h @@ -64,6 +64,23 @@ public: /// \brief Get the operating system specific identifier for this process. virtual id_type get_id() = 0; + /// \brief Get the user time consumed by this process. + /// + /// Note that this is often an approximation and may be zero on platforms + /// where we don't have good support for the functionality. + virtual TimeValue get_user_time() const = 0; + + /// \brief Get the system time consumed by this process. + /// + /// Note that this is often an approximation and may be zero on platforms + /// where we don't have good support for the functionality. + virtual TimeValue get_system_time() const = 0; + + /// \brief Get the wall time consumed by this process. + /// + /// Note that this is often an approximation and may be zero on platforms + /// where we don't have good support for the functionality. + virtual TimeValue get_wall_time() const = 0; /// \name Static factory routines for processes. /// @{ @@ -88,6 +105,9 @@ class self_process : public process { public: virtual id_type get_id(); + virtual TimeValue get_user_time() const; + virtual TimeValue get_system_time() const; + virtual TimeValue get_wall_time() const; /// \name Process configuration (sysconf on POSIX) /// @{ diff --git a/lib/Support/Process.cpp b/lib/Support/Process.cpp index 64a1fa237e..2c0d37bb32 100644 --- a/lib/Support/Process.cpp +++ b/lib/Support/Process.cpp @@ -50,6 +50,31 @@ self_process::~self_process() { llvm_unreachable("This destructor must never be executed!"); } +/// \brief A helper function to compute the elapsed wall-time since the program +/// started. +/// +/// Note that this routine actually computes the elapsed wall time since the +/// first time it was called. However, we arrange to have it called during the +/// startup of the process to get approximately correct results. +static TimeValue getElapsedWallTime() { + static TimeValue &StartTime = *new TimeValue(TimeValue::now()); + return TimeValue::now() - StartTime; +} + +/// \brief A special global variable to ensure we call \c getElapsedWallTime +/// during global initialization of the program. +/// +/// Note that this variable is never referenced elsewhere. Doing so could +/// create race conditions during program startup or shutdown. +static volatile TimeValue DummyTimeValue = getElapsedWallTime(); + +// Implement this routine by using the static helpers above. They're already +// portable. +TimeValue self_process::get_wall_time() const { + return getElapsedWallTime(); +} + + #if defined(_MSC_VER) #pragma warning(pop) #endif diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index 9ad6272bab..a525538f78 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -49,6 +49,43 @@ process::id_type self_process::get_id() { return getpid(); } +static std::pair getRUsageTimes() { +#if defined(HAVE_GETRUSAGE) + struct rusage RU; + ::getrusage(RUSAGE_SELF, &RU); + return std::make_pair( + TimeValue( + static_cast(RU.ru_utime.tv_sec), + static_cast( + RU.ru_utime.tv_usec * TimeValue::NANOSECONDS_PER_MICROSECOND)), + TimeValue( + static_cast(RU.ru_stime.tv_sec), + static_cast( + RU.ru_stime.tv_usec * TimeValue::NANOSECONDS_PER_MICROSECOND))); +#else +#warning Cannot get usage times on this platform + return std::make_pair(TimeValue(), TimeValue()); +#endif +} + +TimeValue self_process::get_user_time() const { +#ifdef _POSIX_CPUTIME + // Try to get a high resolution CPU timer. + struct timespec TS; + if (::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &TS) == 0) + return TimeValue(static_cast(TS.tv_sec), + static_cast(TS.tv_nsec)); +#endif + + // Otherwise fall back to rusage based timing. + return getRUsageTimes().first; +} + +TimeValue self_process::get_system_time() const { + // We can only collect system time by inspecting the results of getrusage. + return getRUsageTimes().second; +} + static unsigned getPageSize() { #if defined(__CYGWIN__) // On Cygwin, getpagesize() returns 64k but the page size for the purposes of @@ -95,29 +132,10 @@ size_t Process::GetMallocUsage() { #endif } -void -Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time, - TimeValue& sys_time) -{ +void Process::GetTimeUsage(TimeValue &elapsed, TimeValue &user_time, + TimeValue &sys_time) { elapsed = TimeValue::now(); -#if defined(HAVE_GETRUSAGE) - struct rusage usage; - ::getrusage(RUSAGE_SELF, &usage); - user_time = TimeValue( - static_cast( usage.ru_utime.tv_sec ), - static_cast( usage.ru_utime.tv_usec * - TimeValue::NANOSECONDS_PER_MICROSECOND ) ); - sys_time = TimeValue( - static_cast( usage.ru_stime.tv_sec ), - static_cast( usage.ru_stime.tv_usec * - TimeValue::NANOSECONDS_PER_MICROSECOND ) ); -#else -#warning Cannot get usage times on this platform - user_time.seconds(0); - user_time.microseconds(0); - sys_time.seconds(0); - sys_time.microseconds(0); -#endif + llvm::tie(user_time, sys_time) = getRUsageTimes(); } int Process::GetCurrentUserId() { diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index 9eb611be87..789ae7ddce 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -43,6 +43,36 @@ process::id_type self_process::get_id() { return GetCurrentProcess(); } +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(TimeInteger.QuadPart / 10000000), + static_cast( + (TimeInteger.QuadPart % 10000000) * 100)); +} + +TimeValue self_process::get_user_time() const { + FILETIME ProcCreate, ProcExit, KernelTime, UserTime; + if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime, + &UserTime) == 0) + return TimeValue(); + + return getTimeValueFromFILETIME(UserTime); +} + +TimeValue self_process::get_system_time() const { + FILETIME ProcCreate, ProcExit, KernelTime, UserTime; + if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime, + &UserTime) == 0) + return TimeValue(); + + return getTimeValueFromFILETIME(KernelTime); +} + // This function retrieves the page size using GetSystemInfo and is present // solely so it can be called once to initialize the self_process member below. static unsigned getPageSize() { @@ -76,22 +106,17 @@ Process::GetMallocUsage() return size; } -void -Process::GetTimeUsage( - TimeValue& elapsed, TimeValue& user_time, TimeValue& sys_time) -{ +void Process::GetTimeUsage(TimeValue &elapsed, TimeValue &user_time, + TimeValue &sys_time) { elapsed = TimeValue::now(); - uint64_t ProcCreate, ProcExit, KernelTime, UserTime; - GetProcessTimes(GetCurrentProcess(), (FILETIME*)&ProcCreate, - (FILETIME*)&ProcExit, (FILETIME*)&KernelTime, - (FILETIME*)&UserTime); + FILETIME ProcCreate, ProcExit, KernelTime, UserTime; + if (GetProcessTimes(GetCurrentProcess(), &ProcCreate, &ProcExit, &KernelTime, + &UserTime) == 0) + return; - // FILETIME's are # of 100 nanosecond ticks (1/10th of a microsecond) - user_time.seconds( UserTime / 10000000 ); - user_time.nanoseconds( unsigned(UserTime % 10000000) * 100 ); - sys_time.seconds( KernelTime / 10000000 ); - sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 ); + user_time = getTimeValueFromFILETIME(UserTime); + sys_time = getTimeValueFromFILETIME(SystemTime); } int Process::GetCurrentUserId() diff --git a/unittests/Support/ProcessTest.cpp b/unittests/Support/ProcessTest.cpp index 58a7c4acaa..e57c0e6eaf 100644 --- a/unittests/Support/ProcessTest.cpp +++ b/unittests/Support/ProcessTest.cpp @@ -30,6 +30,13 @@ TEST(ProcessTest, SelfProcess) { #endif EXPECT_LT(1u, process::get_self()->page_size()); + + EXPECT_LT(TimeValue::MinTime, process::get_self()->get_user_time()); + EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_user_time()); + EXPECT_LT(TimeValue::MinTime, process::get_self()->get_system_time()); + EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_system_time()); + EXPECT_LT(TimeValue::MinTime, process::get_self()->get_wall_time()); + EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_wall_time()); } } // end anonymous namespace -- cgit v1.2.3-70-g09d2