diff options
author | Cthulhu <cthulhu@yandex-team.ru> | 2022-02-10 16:47:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:44 +0300 |
commit | bcb3e9d0eb2a8188a6a9fe0907a8949ce4881a4e (patch) | |
tree | 09f7d6526ac5428ea224cd3cf7bd79809d8e6a07 /util/system/hp_timer.cpp | |
parent | 7b82c914c2f468dd50a208ff6a00d38ee7f0018f (diff) | |
download | ydb-bcb3e9d0eb2a8188a6a9fe0907a8949ce4881a4e.tar.gz |
Restoring authorship annotation for Cthulhu <cthulhu@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/hp_timer.cpp')
-rw-r--r-- | util/system/hp_timer.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/util/system/hp_timer.cpp b/util/system/hp_timer.cpp index e4c3f21e6b..cb80041ebf 100644 --- a/util/system/hp_timer.cpp +++ b/util/system/hp_timer.cpp @@ -21,43 +21,43 @@ namespace { static double EstimateCPUClock() { for (;;) { - ui64 startCycle = 0; - ui64 startMS = 0; - - for (;;) { - startMS = MicroSeconds(); - startCycle = GetCycleCount(); - - ui64 n = MicroSeconds(); - - if (n - startMS < 100) { - break; - } + ui64 startCycle = 0; + ui64 startMS = 0; + + for (;;) { + startMS = MicroSeconds(); + startCycle = GetCycleCount(); + + ui64 n = MicroSeconds(); + + if (n - startMS < 100) { + break; + } } - Sleep(TDuration::MicroSeconds(5000)); + Sleep(TDuration::MicroSeconds(5000)); - ui64 finishCycle = 0; - ui64 finishMS = 0; + ui64 finishCycle = 0; + ui64 finishMS = 0; - for (;;) { - finishMS = MicroSeconds(); + for (;;) { + finishMS = MicroSeconds(); - if (finishMS - startMS < 100) { - continue; - } + if (finishMS - startMS < 100) { + continue; + } - finishCycle = GetCycleCount(); + finishCycle = GetCycleCount(); - ui64 n = MicroSeconds(); + ui64 n = MicroSeconds(); - if (n - finishMS < 100) { - break; - } - } - if (startMS < finishMS && startCycle < finishCycle) { - return (finishCycle - startCycle) * 1000000.0 / (finishMS - startMS); + if (n - finishMS < 100) { + break; + } } + if (startMS < finishMS && startCycle < finishCycle) { + return (finishCycle - startCycle) * 1000000.0 / (finishMS - startMS); + } } } |