aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/hp_timer.cpp
diff options
context:
space:
mode:
authorgulin <gulin@yandex-team.ru>2022-02-10 16:47:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:32 +0300
commit7199613d295246a07c2f7b331fbb3128936039dc (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /util/system/hp_timer.cpp
parentc807aae441c17fc7f577c35757a4b6e0bd909802 (diff)
downloadydb-7199613d295246a07c2f7b331fbb3128936039dc.tar.gz
Restoring authorship annotation for <gulin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/hp_timer.cpp')
-rw-r--r--util/system/hp_timer.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/util/system/hp_timer.cpp b/util/system/hp_timer.cpp
index 05ea5216bd..e4c3f21e6b 100644
--- a/util/system/hp_timer.cpp
+++ b/util/system/hp_timer.cpp
@@ -4,8 +4,8 @@
#include <util/generic/singleton.h>
#include <util/datetime/cputimer.h>
-using namespace NHPTimer;
-
+using namespace NHPTimer;
+
namespace {
struct TFreq {
inline TFreq()
@@ -13,12 +13,12 @@ namespace {
, Rate(1.0 / Freq)
, CyclesPerSecond(static_cast<ui64>(Rate))
{
- }
+ }
static inline const TFreq& Instance() {
return *SingletonWithPriority<TFreq, 1>();
- }
-
+ }
+
static double EstimateCPUClock() {
for (;;) {
ui64 startCycle = 0;
@@ -91,28 +91,28 @@ namespace {
const double Rate;
const ui64 CyclesPerSecond;
};
-}
-
+}
+
double NHPTimer::GetSeconds(const STime& a) noexcept {
return TFreq::Instance().GetSeconds(a);
-}
-
+}
+
double NHPTimer::GetClockRate() noexcept {
return TFreq::Instance().GetClockRate();
-}
-
+}
+
ui64 NHPTimer::GetCyclesPerSecond() noexcept {
return TFreq::Instance().GetCyclesPerSecond();
}
void NHPTimer::GetTime(STime* pTime) noexcept {
- *pTime = GetCycleCount();
-}
-
+ *pTime = GetCycleCount();
+}
+
double NHPTimer::GetTimePassed(STime* pTime) noexcept {
- STime old(*pTime);
+ STime old(*pTime);
*pTime = GetCycleCount();
- return GetSeconds(*pTime - old);
-}
+ return GetSeconds(*pTime - old);
+}