diff options
author | earwin <earwin@yandex-team.ru> | 2022-02-10 16:51:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:51:51 +0300 |
commit | 77e5f5b6f9765d5dd8c47e7011c9d09d6237f4aa (patch) | |
tree | a330e3e1511d005df68cb1108e241138628a96c7 | |
parent | 9f297e4a2d8d5767cf42b4047d45ad1f0483cce2 (diff) | |
download | ydb-77e5f5b6f9765d5dd8c47e7011c9d09d6237f4aa.tar.gz |
Restoring authorship annotation for <earwin@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | util/system/cpu_id.cpp | 8 | ||||
-rw-r--r-- | util/system/datetime.cpp | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp index 598c71f4d9..5cfa4073ba 100644 --- a/util/system/cpu_id.cpp +++ b/util/system/cpu_id.cpp @@ -1,7 +1,7 @@ #include "cpu_id.h" #include "types.h" #include "platform.h" - + #include <util/generic/singleton.h> #if defined(_win_) @@ -12,7 +12,7 @@ #endif #include <string.h> - + #if defined(_x86_) && !defined(_win_) static ui64 _xgetbv(ui32 xcr) { ui32 eax; @@ -81,9 +81,9 @@ namespace { NX86::CpuId(op, subOp, Info); } }; - + static_assert(sizeof(TX86CpuInfo) == 16, "please, fix me"); -} +} // https://en.wikipedia.org/wiki/CPUID bool NX86::HaveRDTSCP() noexcept { diff --git a/util/system/datetime.cpp b/util/system/datetime.cpp index b07b50679a..2585c12a2b 100644 --- a/util/system/datetime.cpp +++ b/util/system/datetime.cpp @@ -23,19 +23,19 @@ static ui64 ToMicroSeconds(const struct timeval& tv) { #if defined(_win_) static ui64 ToMicroSeconds(const FILETIME& ft) { - return (((ui64)ft.dwHighDateTime << 32) + (ui64)ft.dwLowDateTime) / (ui64)10; -} + return (((ui64)ft.dwHighDateTime << 32) + (ui64)ft.dwLowDateTime) / (ui64)10; +} #elif defined(Y_HAS_CLOCK_GETTIME) static ui64 ToMicroSeconds(const struct timespec& ts) { return (ui64)ts.tv_sec * 1000000 + (ui64)ts.tv_nsec / 1000; } -#endif - +#endif + ui64 MicroSeconds() noexcept { struct timeval tv; gettimeofday(&tv, nullptr); - return ToMicroSeconds(tv); + return ToMicroSeconds(tv); } ui64 ThreadCPUUserTime() noexcept { @@ -64,9 +64,9 @@ ui64 ThreadCPUTime() noexcept { GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); return ToMicroSeconds(userTime) + ToMicroSeconds(kernelTime); #elif defined(Y_HAS_CLOCK_GETTIME) - struct timespec ts; - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); - return ToMicroSeconds(ts); + struct timespec ts; + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); + return ToMicroSeconds(ts); #else return 0; #endif |