Skip to content

Commit

Permalink
fix time measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
kunga committed Jan 8, 2025
1 parent 44817e8 commit 55eb4e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions ydb/core/tablet_flat/util_fmt_basic.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "util_fmt_desc.h"
#include <util/datetime/base.h>

namespace NKikimr {
namespace NFmt {
Expand Down
9 changes: 6 additions & 3 deletions ydb/core/tx/schemeshard/ut_login_large/ut_login_large.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <chrono>
#include <ydb/core/protos/schemeshard/operations.pb.h>
#include <ydb/core/tablet_flat/util_fmt_basic.h>
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>

using namespace NKikimr;
Expand All @@ -8,16 +10,17 @@ using namespace NSchemeShardUT_Private;
struct TLogStopwatch {
TLogStopwatch(TString message)
: Message(std::move(message))
, Started(TAppData::TimeProvider->Now())
, Started(std::chrono::steady_clock::now())
{}

~TLogStopwatch() {
Cerr << "[STOPWATCH] " << Message << " in " << (TAppData::TimeProvider->Now() - Started).MilliSeconds() << "ms" << Endl;
std::chrono::steady_clock::time_point ended = std::chrono::steady_clock::now();
Cerr << "[STOPWATCH] " << Message << " in " << NFmt::TDelay(TDuration::MicroSeconds(std::chrono::duration_cast<std::chrono::microseconds>(ended - Started).count())) << Endl;
}

private:
TString Message;
TInstant Started;
std::chrono::steady_clock::time_point Started;
};

Y_UNIT_TEST_SUITE(TSchemeShardLoginLargeTest) {
Expand Down

0 comments on commit 55eb4e7

Please sign in to comment.