forked from premiere/premiere-libtorrent
windows version of CPU time measurement
This commit is contained in:
parent
7d20c0b0c4
commit
95e462e750
|
@ -3228,7 +3228,19 @@ namespace aux {
|
|||
+ seconds(ru.ru_stime.tv_sec)
|
||||
+ microsec(ru.ru_stime.tv_usec);
|
||||
#elif defined TORRENT_WINDOWS
|
||||
// GetThreadTimes
|
||||
FILETIME system_time;
|
||||
FILETIME user_time;
|
||||
FILETIME creation_time;
|
||||
FILETIME exit_time;
|
||||
GetThreadTimes(GetCurrentThread(), &creation_time, &exit_time, &user_time, &system_time);
|
||||
|
||||
boost::uint64_t utime = (boost::uint64_t(user_time.dwhighdatetime) << 32)
|
||||
+ user_time.dwlowdatetime;
|
||||
boost::uint64_t stime = (boost::uint64_t(system_time.dwhighdatetime) << 32)
|
||||
+ system_time.dwlowdatetime;
|
||||
|
||||
tu->user_time = min_time() + microsec(utime / 10);
|
||||
tu->system_time = min_time() + microsec(stime / 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue