diff options
author | kaliki <kaliki@yandex-team.ru> | 2022-02-10 16:48:06 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:06 +0300 |
commit | a79404df3a1d90f4b37ac8a1ce0a2bfb5dfd06f1 (patch) | |
tree | 3302aab790ee7891a6ed0b4b9257ab4dd02ae4c1 /util/system | |
parent | b552921bb1c7ea535f6e0e1706feb311c27d6036 (diff) | |
download | ydb-a79404df3a1d90f4b37ac8a1ce0a2bfb5dfd06f1.tar.gz |
Restoring authorship annotation for <kaliki@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/datetime.cpp | 44 | ||||
-rw-r--r-- | util/system/datetime.h | 2 | ||||
-rw-r--r-- | util/system/file.cpp | 10 |
3 files changed, 28 insertions, 28 deletions
diff --git a/util/system/datetime.cpp b/util/system/datetime.cpp index b07b50679a..0ea6c77ac2 100644 --- a/util/system/datetime.cpp +++ b/util/system/datetime.cpp @@ -40,38 +40,38 @@ ui64 MicroSeconds() noexcept { ui64 ThreadCPUUserTime() noexcept { #if defined(_win_) - FILETIME creationTime, exitTime, kernelTime, userTime; - GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); - return ToMicroSeconds(userTime); -#else - return 0; -#endif -} - + FILETIME creationTime, exitTime, kernelTime, userTime; + GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); + return ToMicroSeconds(userTime); +#else + return 0; +#endif +} + ui64 ThreadCPUSystemTime() noexcept { #if defined(_win_) - FILETIME creationTime, exitTime, kernelTime, userTime; - GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); - return ToMicroSeconds(kernelTime); -#else - return 0; -#endif -} - + FILETIME creationTime, exitTime, kernelTime, userTime; + GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); + return ToMicroSeconds(kernelTime); +#else + return 0; +#endif +} + ui64 ThreadCPUTime() noexcept { #if defined(_win_) - FILETIME creationTime, exitTime, kernelTime, userTime; - GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime, &userTime); - return ToMicroSeconds(userTime) + ToMicroSeconds(kernelTime); + FILETIME creationTime, exitTime, kernelTime, userTime; + 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); #else return 0; -#endif -} - +#endif +} + ui32 Seconds() noexcept { struct timeval tv; gettimeofday(&tv, nullptr); diff --git a/util/system/datetime.h b/util/system/datetime.h index aa009974e0..1d502cac96 100644 --- a/util/system/datetime.h +++ b/util/system/datetime.h @@ -27,7 +27,7 @@ inline ui64 millisec() { } /// Current time in seconds since epoch ui32 Seconds() noexcept; -///Current thread time in microseconds +///Current thread time in microseconds ui64 ThreadCPUUserTime() noexcept; ui64 ThreadCPUSystemTime() noexcept; ui64 ThreadCPUTime() noexcept; diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020c..c2ef13aae1 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -106,11 +106,11 @@ TFileHandle::TFileHandle(const TString& fName, EOpenMode oMode) noexcept { faMode |= GENERIC_WRITE; } if (oMode & ::ForAppend) { - faMode |= GENERIC_WRITE; + faMode |= GENERIC_WRITE; faMode |= FILE_APPEND_DATA; - faMode &= ~FILE_WRITE_DATA; - } - + faMode &= ~FILE_WRITE_DATA; + } + bool inheritHandle = !(oMode & CloseOnExec); ui32 shMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; @@ -139,7 +139,7 @@ TFileHandle::TFileHandle(const TString& fName, EOpenMode oMode) noexcept { if ((oMode & ::ForAppend) && (Fd_ != INVALID_FHANDLE)) { ::SetFilePointer(Fd_, 0, 0, FILE_END); } - + #elif defined(_unix_) switch (createMode) { |