diff options
author | leo <[email protected]> | 2022-02-10 16:46:40 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:40 +0300 |
commit | 980edcd3304699edf9d4e4d6a656e585028e2a72 (patch) | |
tree | 139f47f3911484ae9af0eb347b1a88bd6c4bb35f /util/datetime/cputimer.cpp | |
parent | b036a557f285146e5e35d4213e29a094ab907bcf (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/datetime/cputimer.cpp')
-rw-r--r-- | util/datetime/cputimer.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/util/datetime/cputimer.cpp b/util/datetime/cputimer.cpp index 516d372c374..24e40ff8bb3 100644 --- a/util/datetime/cputimer.cpp +++ b/util/datetime/cputimer.cpp @@ -5,7 +5,7 @@ #include <util/string/printf.h> #include <util/stream/output.h> #include <util/generic/singleton.h> - + #if defined(_unix_) #include <unistd.h> #include <sched.h> @@ -14,7 +14,7 @@ #include <sys/param.h> #elif defined(_win_) #include <util/system/winint.h> -#endif +#endif TTimer::TTimer(const TStringBuf message) { static const int SMALL_DURATION_CHAR_LENGTH = 9; // strlen("0.123456s") @@ -90,7 +90,7 @@ TFormattedPrecisionTimer::~TFormattedPrecisionTimer() { *Out << Message << ": " << diff << " ticks " << FormatCycles(diff) << Endl; } - + TFuncTimer::TFuncTimer(const char* func) : Start_(TInstant::Now()) , Func_(func) @@ -103,26 +103,26 @@ TFuncTimer::~TFuncTimer() { } TTimeLogger::TTimeLogger(const TString& message, bool verbose) - : Message(message) + : Message(message) , Verbose(verbose) - , OK(false) + , OK(false) , Begin(time(nullptr)) , BeginCycles(GetCycleCount()) -{ +{ if (Verbose) { fprintf(stderr, "=========================================================\n"); fprintf(stderr, "%s started: %.24s (%lu) (%d)\n", Message.data(), ctime(&Begin), (unsigned long)Begin, (int)getpid()); } -} - +} + double TTimeLogger::ElapsedTime() const { return time(nullptr) - Begin; } void TTimeLogger::SetOK() { - OK = true; -} - + OK = true; +} + TTimeLogger::~TTimeLogger() { time_t tim = time(nullptr); ui64 endCycles = GetCycleCount(); @@ -133,4 +133,4 @@ TTimeLogger::~TTimeLogger() { (unsigned long)tim - (unsigned long)Begin, FormatCycles(endCycles - BeginCycles).data()); fprintf(stderr, "%s=========================================================\n", prefix); } -} +} |