Changeset 35850 in vbox
- Timestamp:
- Feb 4, 2011 1:22:30 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp
r35807 r35850 41 41 # include <sys/resource.h> 42 42 #endif 43 #if defined(RT_OS_DARWIN) 44 # include <mach/thread_act.h> 45 # include <mach/thread_info.h> 46 # include <mach/host_info.h> 47 # include <mach/mach_init.h> 48 # include <mach/mach_host.h> 49 #endif 43 50 44 51 #include <iprt/thread.h> … … 423 430 *pUserTime = ts.ru_utime.tv_sec * 1000 + ts.ru_utime.tv_usec / 1000; 424 431 return VINF_SUCCESS; 425 #elif !defined(RT_OS_DARWIN)432 #elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) 426 433 /* on Linux, getrusage(RUSAGE_THREAD, ...) is available since 2.6.26 */ 427 434 struct timespec ts; … … 433 440 *pUserTime = (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000; 434 441 return VINF_SUCCESS; 442 #elif defined(RT_OS_DARWIN) 443 thread_basic_info ThreadInfo; 444 mach_msg_type_number_t Count = sizeof(ThreadInfo) / sizeof(int); 445 kern_return_t krc; 446 447 krc = thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)&ThreadInfo, &Count); 448 Assert(krc == KERN_SUCCESS); 449 450 *pKernelTime = ThreadInfo.system_time.seconds * 1000 + ThreadInfo.system_time.microseconds / 1000; 451 *pUserTime = ThreadInfo.user_time.seconds * 1000 + ThreadInfo.user_time.microseconds / 1000;; 452 453 return VINF_SUCCESS; 435 454 #else 436 455 return VERR_NOT_IMPLEMENTED;
Note:
See TracChangeset
for help on using the changeset viewer.