diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/datetime/cputimer.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/datetime/cputimer.h')
-rw-r--r-- | util/datetime/cputimer.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/util/datetime/cputimer.h b/util/datetime/cputimer.h index 7d38d5bdb3..c6d2b6a933 100644 --- a/util/datetime/cputimer.h +++ b/util/datetime/cputimer.h @@ -1,54 +1,54 @@ #pragma once -#include "base.h" - +#include "base.h" + #include <util/system/rusage.h> #include <util/generic/string.h> #include <util/stream/str.h> - + class TTimer { private: TInstant Start_; TStringStream Message_; - + public: TTimer(const TStringBuf message = TStringBuf(" took: ")); ~TTimer(); }; -class TSimpleTimer { +class TSimpleTimer { TInstant T; - + public: - TSimpleTimer() { + TSimpleTimer() { Reset(); } TDuration Get() const { return TInstant::Now() - T; } - void Reset() { + void Reset() { T = TInstant::Now(); } }; -class TProfileTimer { +class TProfileTimer { TDuration T; - + public: - TProfileTimer() { + TProfileTimer() { Reset(); } TDuration Get() const { return TRusage::Get().Utime - T; } - TDuration Step() { + TDuration Step() { TRusage r; r.Fill(); TDuration d = r.Utime - T; T = r.Utime; return d; } - void Reset() { + void Reset() { T = TRusage::Get().Utime; } }; @@ -62,7 +62,7 @@ void SetCyclesPerSecond(ui64 cycles); TDuration CyclesToDuration(ui64 cycles); ui64 DurationToCycles(TDuration duration); -class TPrecisionTimer { +class TPrecisionTimer { private: ui64 Start = 0; @@ -74,7 +74,7 @@ public: TString FormatCycles(ui64 cycles); -class TFormattedPrecisionTimer { +class TFormattedPrecisionTimer { private: ui64 Start; const char* Message; @@ -85,29 +85,29 @@ public: ~TFormattedPrecisionTimer(); }; -class TFuncTimer { -public: +class TFuncTimer { +public: TFuncTimer(const char* func); ~TFuncTimer(); - -private: + +private: const TInstant Start_; - const char* Func_; -}; - -class TFakeTimer { -public: + const char* Func_; +}; + +class TFakeTimer { +public: inline TFakeTimer(const char* = nullptr) noexcept { - } -}; - -#if defined(WITH_DEBUG) - #define TDebugTimer TFuncTimer -#else - #define TDebugTimer TFakeTimer + } +}; + +#if defined(WITH_DEBUG) + #define TDebugTimer TFuncTimer +#else + #define TDebugTimer TFakeTimer #endif - -class TTimeLogger { + +class TTimeLogger { private: TString Message; bool Verbose; |