diff options
author | babenko <babenko@yandex-team.com> | 2024-05-21 09:25:53 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2024-05-21 09:37:12 +0300 |
commit | ea58ae291cc530f91033d25b6ffa71ec25f99c37 (patch) | |
tree | fb2588d14bff055d1af13d2f3bc2bcb6d5a67a97 /library/cpp/yt/logging/logger.h | |
parent | 7e5f63a2ba51e97fdac0d7bda613ceeb97ff2a0c (diff) | |
download | ydb-ea58ae291cc530f91033d25b6ffa71ec25f99c37.tar.gz |
Don't use per-TLS anchor counters
85eb5ffdc79771c842f049e9392902ac6868cece
Diffstat (limited to 'library/cpp/yt/logging/logger.h')
-rw-r--r-- | library/cpp/yt/logging/logger.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/library/cpp/yt/logging/logger.h b/library/cpp/yt/logging/logger.h index 693ea2b9cd..4f0ed44ab7 100644 --- a/library/cpp/yt/logging/logger.h +++ b/library/cpp/yt/logging/logger.h @@ -56,7 +56,7 @@ struct TLoggingAnchor struct TCounter { - std::atomic<i64> Current = 0; + i64 Current = 0; i64 Previous = 0; }; @@ -100,6 +100,8 @@ struct TLogEvent TStringBuf SourceFile; int SourceLine = -1; + + TLoggingAnchor* Anchor = nullptr; }; //////////////////////////////////////////////////////////////////////////////// @@ -328,21 +330,12 @@ void LogStructuredEvent( break; \ } \ \ - static thread_local i64 localByteCounter__; \ - static thread_local ui8 localMessageCounter__; \ - \ - localByteCounter__ += message__.MessageRef.Size(); \ - if (Y_UNLIKELY(++localMessageCounter__ == 0)) { \ - anchor__->MessageCounter.Current += 256; \ - anchor__->ByteCounter.Current += localByteCounter__; \ - localByteCounter__ = 0; \ - } \ - \ ::NYT::NLogging::NDetail::LogEventImpl( \ loggingContext__, \ logger__, \ level__, \ location__, \ + anchor__, \ std::move(message__.MessageRef)); \ } while (false) |