diff options
author | denplusplus <[email protected]> | 2022-02-10 16:47:34 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:34 +0300 |
commit | 57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (patch) | |
tree | cc63639f8e502db19a82c20e2861c6d1edbf9fea /util/datetime/cputimer.h | |
parent | 464ba3814a83db4f2d5327393b0b6eaf0c86bfd7 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/datetime/cputimer.h')
-rw-r--r-- | util/datetime/cputimer.h | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/util/datetime/cputimer.h b/util/datetime/cputimer.h index 7d38d5bdb38..d43102dff6d 100644 --- a/util/datetime/cputimer.h +++ b/util/datetime/cputimer.h @@ -6,14 +6,14 @@ #include <util/generic/string.h> #include <util/stream/str.h> -class TTimer { +class TTimer { private: TInstant Start_; TStringStream Message_; public: TTimer(const TStringBuf message = TStringBuf(" took: ")); - ~TTimer(); + ~TTimer(); }; class TSimpleTimer { @@ -56,38 +56,38 @@ public: /// Return cached processor cycle count per second. Method takes 1 second at first invocation. /// Note, on older systems cycle rate may change during program lifetime, /// so returned value may be incorrect. Modern Intel and AMD processors keep constant TSC rate. -ui64 GetCyclesPerMillisecond(); +ui64 GetCyclesPerMillisecond(); void SetCyclesPerSecond(ui64 cycles); - + TDuration CyclesToDuration(ui64 cycles); ui64 DurationToCycles(TDuration duration); class TPrecisionTimer { -private: +private: ui64 Start = 0; - -public: + +public: TPrecisionTimer(); ui64 GetCycleCount() const; -}; - +}; + TString FormatCycles(ui64 cycles); - + class TFormattedPrecisionTimer { -private: - ui64 Start; - const char* Message; +private: + ui64 Start; + const char* Message; IOutputStream* Out; - -public: + +public: TFormattedPrecisionTimer(const char* message = "took ", IOutputStream* out = &Cout); - ~TFormattedPrecisionTimer(); -}; - + ~TFormattedPrecisionTimer(); +}; + class TFuncTimer { public: - TFuncTimer(const char* func); + TFuncTimer(const char* func); ~TFuncTimer(); private: @@ -105,20 +105,20 @@ public: #define TDebugTimer TFuncTimer #else #define TDebugTimer TFakeTimer -#endif +#endif class TTimeLogger { private: TString Message; - bool Verbose; + bool Verbose; bool OK; - time_t Begin; - ui64 BeginCycles; + time_t Begin; + ui64 BeginCycles; public: TTimeLogger(const TString& message, bool verbose = true); ~TTimeLogger(); void SetOK(); - double ElapsedTime() const; + double ElapsedTime() const; }; |