diff options
author | prime <prime@yandex-team.ru> | 2022-02-10 16:46:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:01 +0300 |
commit | e34f3f0e381020a427f44fbd50463d9a04089db3 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp | |
parent | 3695a7cd42b74a4987d8d5a8f2e2443556998943 (diff) | |
download | ydb-e34f3f0e381020a427f44fbd50463d9a04089db3.tar.gz |
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
30 files changed, 205 insertions, 205 deletions
diff --git a/library/cpp/malloc/tcmalloc/ya.make b/library/cpp/malloc/tcmalloc/ya.make index 4eb86ecb0d..21372ff9e2 100644 --- a/library/cpp/malloc/tcmalloc/ya.make +++ b/library/cpp/malloc/tcmalloc/ya.make @@ -6,7 +6,7 @@ OWNER(ayles) PEERDIR( library/cpp/malloc/api - contrib/libs/tcmalloc/malloc_extension + contrib/libs/tcmalloc/malloc_extension ) SRCS( malloc-info.cpp diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp index 3f18e42d6e..87c832d642 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.cpp @@ -89,25 +89,25 @@ void TBufferedEncoderBase::OnLabel(TStringBuf name, TStringBuf value) { labels->emplace_back(LabelNamesPool_.PutIfAbsent(name), LabelValuesPool_.PutIfAbsent(value)); } -void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) { - TPooledLabels* labels; - if (State_ == TEncoderState::EState::METRIC_LABELS) { - labels = &Metrics_.back().Labels; - } else if (State_ == TEncoderState::EState::COMMON_LABELS) { - labels = &CommonLabels_; - } else { - State_.ThrowInvalid("expected LABELS or COMMON_LABELS"); - } - - labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value)); -} - +void TBufferedEncoderBase::OnLabel(ui32 name, ui32 value) { + TPooledLabels* labels; + if (State_ == TEncoderState::EState::METRIC_LABELS) { + labels = &Metrics_.back().Labels; + } else if (State_ == TEncoderState::EState::COMMON_LABELS) { + labels = &CommonLabels_; + } else { + State_.ThrowInvalid("expected LABELS or COMMON_LABELS"); + } + + labels->emplace_back(LabelNamesPool_.GetByIndex(name), LabelValuesPool_.GetByIndex(value)); +} + std::pair<ui32, ui32> TBufferedEncoderBase::PrepareLabel(TStringBuf name, TStringBuf value) { - auto nameLabel = LabelNamesPool_.PutIfAbsent(name); - auto valueLabel = LabelValuesPool_.PutIfAbsent(value); - return std::make_pair(nameLabel->Index, valueLabel->Index); -} - + auto nameLabel = LabelNamesPool_.PutIfAbsent(name); + auto valueLabel = LabelValuesPool_.PutIfAbsent(value); + return std::make_pair(nameLabel->Index, valueLabel->Index); +} + void TBufferedEncoderBase::OnDouble(TInstant time, double value) { State_.Expect(TEncoderState::EState::METRIC); TMetric& metric = Metrics_.back(); diff --git a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h index 165d92203e..fe3714e58f 100644 --- a/library/cpp/monlib/encode/buffered/buffered_encoder_base.h +++ b/library/cpp/monlib/encode/buffered/buffered_encoder_base.h @@ -26,7 +26,7 @@ public: void OnLabelsBegin() override; void OnLabelsEnd() override; void OnLabel(TStringBuf name, TStringBuf value) override; - void OnLabel(ui32 name, ui32 value) override; + void OnLabel(ui32 name, ui32 value) override; std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value) override; void OnDouble(TInstant time, double value) override; diff --git a/library/cpp/monlib/encode/buffered/string_pool.cpp b/library/cpp/monlib/encode/buffered/string_pool.cpp index d819e11ae7..b4c7988ba3 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool.cpp @@ -10,8 +10,8 @@ namespace NMonitoring { auto [it, isInserted] = StrMap_.try_emplace(str, Max<ui32>(), 0); if (isInserted) { BytesSize_ += str.size(); - it->second.Index = StrVector_.size(); - StrVector_.emplace_back(it->first, &it->second); + it->second.Index = StrVector_.size(); + StrVector_.emplace_back(it->first, &it->second); } TValue* value = &it->second; @@ -19,10 +19,10 @@ namespace NMonitoring { return value; } - const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const { - return StrVector_.at(index).second; - } - + const TStringPoolBuilder::TValue* TStringPoolBuilder::GetByIndex(ui32 index) const { + return StrVector_.at(index).second; + } + TStringPoolBuilder& TStringPoolBuilder::Build() { if (RequiresSorting_) { // sort in reversed order @@ -30,10 +30,10 @@ namespace NMonitoring { return a.second->Frequency > b.second->Frequency; }); - ui32 i = 0; - for (auto& value : StrVector_) { - value.second->Index = i++; - } + ui32 i = 0; + for (auto& value : StrVector_) { + value.second->Index = i++; + } } IsBuilt_ = true; diff --git a/library/cpp/monlib/encode/buffered/string_pool.h b/library/cpp/monlib/encode/buffered/string_pool.h index e216cff388..00e5644608 100644 --- a/library/cpp/monlib/encode/buffered/string_pool.h +++ b/library/cpp/monlib/encode/buffered/string_pool.h @@ -22,7 +22,7 @@ namespace NMonitoring { public: const TValue* PutIfAbsent(TStringBuf str); - const TValue* GetByIndex(ui32 index) const; + const TValue* GetByIndex(ui32 index) const; /// Determines whether pool must be sorted by value frequencies TStringPoolBuilder& SetSorted(bool sorted) { diff --git a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp index 21839ccb47..9fc3421d0b 100644 --- a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp @@ -16,10 +16,10 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) { UNIT_ASSERT(h2 == h3); UNIT_ASSERT_VALUES_EQUAL(h1->Frequency, 1); - UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0); + UNIT_ASSERT_VALUES_EQUAL(h1->Index, 0); UNIT_ASSERT_VALUES_EQUAL(h2->Frequency, 2); - UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1); + UNIT_ASSERT_VALUES_EQUAL(h2->Index, 1); UNIT_ASSERT_VALUES_EQUAL(strPool.BytesSize(), 6); UNIT_ASSERT_VALUES_EQUAL(strPool.Count(), 2); @@ -49,8 +49,8 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) { Y_UNIT_TEST(ForEach) { TStringPoolBuilder strPool; - strPool.SetSorted(true); - + strPool.SetSorted(true); + strPool.PutIfAbsent("one"); strPool.PutIfAbsent("two"); strPool.PutIfAbsent("two"); diff --git a/library/cpp/monlib/encode/json/json_encoder.cpp b/library/cpp/monlib/encode/json/json_encoder.cpp index e376cbb564..20d2bb6283 100644 --- a/library/cpp/monlib/encode/json/json_encoder.cpp +++ b/library/cpp/monlib/encode/json/json_encoder.cpp @@ -440,11 +440,11 @@ namespace NMonitoring { EmptyLabels_ = false; } - void OnLabel(ui32 name, ui32 value) override { - TBufferedEncoderBase::OnLabel(name, value); - EmptyLabels_ = false; - } - + void OnLabel(ui32 name, ui32 value) override { + TBufferedEncoderBase::OnLabel(name, value); + EmptyLabels_ = false; + } + void OnLabelsEnd() override { TBufferedEncoderBase::OnLabelsEnd(); Y_ENSURE(!EmptyLabels_, "Labels cannot be empty"); diff --git a/library/cpp/monlib/encode/json/json_ut.cpp b/library/cpp/monlib/encode/json/json_ut.cpp index 281c114a23..09e7909289 100644 --- a/library/cpp/monlib/encode/json/json_ut.cpp +++ b/library/cpp/monlib/encode/json/json_ut.cpp @@ -225,14 +225,14 @@ Y_UNIT_TEST_SUITE(TJsonTest) { e->Close(); json += "\n"; - auto parseJson = [] (auto buf) { - NJson::TJsonValue value; - NJson::ReadJsonTree(buf, &value, true); - return value; - }; - + auto parseJson = [] (auto buf) { + NJson::TJsonValue value; + NJson::ReadJsonTree(buf, &value, true); + return value; + }; + const auto expectedJson = NResource::Find(expectedResourceKey); - UNIT_ASSERT_EQUAL(parseJson(json), parseJson(expectedJson)); + UNIT_ASSERT_EQUAL(parseJson(json), parseJson(expectedJson)); }; check(false, false, "/expected.json"); diff --git a/library/cpp/monlib/encode/json/ut/expected_buffered.json b/library/cpp/monlib/encode/json/ut/expected_buffered.json index 0441766a68..9a6a1d6201 100644 --- a/library/cpp/monlib/encode/json/ut/expected_buffered.json +++ b/library/cpp/monlib/encode/json/ut/expected_buffered.json @@ -10,8 +10,8 @@ "kind":"COUNTER", "labels": { - "labels":"l1", - "metric":"single" + "labels":"l1", + "metric":"single" }, "ts":1509843723, "value":17 @@ -20,8 +20,8 @@ "kind":"RATE", "labels": { - "labels":"l2", - "metric":"single" + "labels":"l2", + "metric":"single" }, "ts":1509843723, "value":17 @@ -30,8 +30,8 @@ "kind":"GAUGE", "labels": { - "labels":"l3", - "metric":"single" + "labels":"l3", + "metric":"single" }, "ts":1509843723, "value":3.14 @@ -40,8 +40,8 @@ "kind":"IGAUGE", "labels": { - "labels":"l4", - "metric":"single_igauge" + "labels":"l4", + "metric":"single_igauge" }, "ts":1509843723, "value":42 @@ -50,8 +50,8 @@ "kind":"GAUGE", "labels": { - "labels":"l5", - "metric":"multiple" + "labels":"l5", + "metric":"multiple" }, "timeseries": [ @@ -73,8 +73,8 @@ "kind":"COUNTER", "labels": { - "labels":"l6", - "metric":"multiple" + "labels":"l6", + "metric":"multiple" }, "timeseries": [ diff --git a/library/cpp/monlib/encode/spack/spack_v1_ut.cpp b/library/cpp/monlib/encode/spack/spack_v1_ut.cpp index 7802f7c5e9..fe778eb7e0 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_ut.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_ut.cpp @@ -78,18 +78,18 @@ Y_UNIT_TEST_SUITE(TSpackTest) { ui8 expectedStringPools[] = { 0x6e, 0x61, 0x6d, 0x65, 0x00, // "name\0" 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x00, // "project\0" - 0x73, 0x6f, 0x6c, 0x6f, 0x6d, 0x6f, 0x6e, 0x00, // "solomon\0" - 0x71, 0x31, 0x00, // "q1\0" - 0x71, 0x32, 0x00, // "q2\0" - 0x71, 0x33, 0x00, // "q3\0" - 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x00, // "answer\0" + 0x73, 0x6f, 0x6c, 0x6f, 0x6d, 0x6f, 0x6e, 0x00, // "solomon\0" + 0x71, 0x31, 0x00, // "q1\0" + 0x71, 0x32, 0x00, // "q2\0" + 0x71, 0x33, 0x00, // "q3\0" + 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x00, // "answer\0" 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, // "responseTimeMillis\0" 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x00, 0x62, 0x79, 0x74, 0x65, 0x73, 0x00, // "bytes\0" - 0x74, 0x65, 0x6D, 0x70, 0x65, 0x72, 0x61, 0x74, // "temperature\0" - 0x75, 0x72, 0x65, 0x00, - 0x6d, 0x73, 0x00, // "ms\0" + 0x74, 0x65, 0x6D, 0x70, 0x65, 0x72, 0x61, 0x74, // "temperature\0" + 0x75, 0x72, 0x65, 0x00, + 0x6d, 0x73, 0x00, // "ms\0" }; ui8 expectedCommonTime[] = { @@ -99,7 +99,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { ui8 expectedCommonLabels[] = { 0x01, // common labels count (varint) 0x01, // label name index (varint) - 0x00, // label value index (varint) + 0x00, // label value index (varint) }; ui8 expectedMetric1[] = { @@ -107,7 +107,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { 0x00, // flags (fixed ui8) 0x01, // metric labels count (varint) 0x00, // label name index (varint) - 0x01, // label value index (varint) + 0x01, // label value index (varint) }; ui8 expectedMetric2[] = { @@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { 0x00, // flags (fixed ui8) 0x01, // metric labels count (varint) 0x00, // label name index (varint) - 0x02, // label value index (varint) + 0x02, // label value index (varint) 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // value (fixed ui64) }; @@ -147,7 +147,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { 0x00, // flags (fixed ui8) 0x01, // metric labels count (varint) 0x00, // label name index (varint) - 0x05, // label value index (varint) + 0x05, // label value index (varint) 0x0b, 0x63, 0xfe, 0x59, // time in seconds (fixed ui32) 0x06, // histogram buckets count (varint) 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // histogram bucket bounds (array of fixed ui64) @@ -169,7 +169,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { 0x00, // flags (fixed ui8) 0x01, // metric labels count (varint) 0x00, // label name index (varint) - 0x05, // label value index (varint) + 0x05, // label value index (varint) 0x0b, 0x63, 0xfe, 0x59, // time in seconds (fixed ui32) 0x06, // histogram buckets count (varint) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, // histogram bucket bounds (array of doubles) @@ -201,7 +201,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { 0x00, // flags (fixed ui8) 0x01, // metric labels count (varint) 0x00, // label name index (varint) - 0x07, // label value index (varint) + 0x07, // label value index (varint) 0x0b, 0x63, 0xfe, 0x59, // time in seconds (fixed ui32) 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // count (fixed ui64) 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x24, 0x40, // sum (fixed double) @@ -755,7 +755,7 @@ Y_UNIT_TEST_SUITE(TSpackTest) { e->OnMetricBegin(EMetricType::COUNTER); { e->OnLabelsBegin(); - e->OnLabel("project", "solomon"); + e->OnLabel("project", "solomon"); e->OnLabel("s", "temperature"); e->OnLabelsEnd(); } diff --git a/library/cpp/monlib/metrics/metric_consumer.cpp b/library/cpp/monlib/metrics/metric_consumer.cpp index c2155f4b5b..121ee368f0 100644 --- a/library/cpp/monlib/metrics/metric_consumer.cpp +++ b/library/cpp/monlib/metrics/metric_consumer.cpp @@ -1,15 +1,15 @@ -#include "metric_consumer.h" - -#include <util/system/yassert.h> - -namespace NMonitoring { - void IMetricConsumer::OnLabel(ui32 name, ui32 value) { - Y_UNUSED(name, value); - Y_ENSURE(false, "Not implemented"); - } - +#include "metric_consumer.h" + +#include <util/system/yassert.h> + +namespace NMonitoring { + void IMetricConsumer::OnLabel(ui32 name, ui32 value) { + Y_UNUSED(name, value); + Y_ENSURE(false, "Not implemented"); + } + std::pair<ui32, ui32> IMetricConsumer::PrepareLabel(TStringBuf name, TStringBuf value) { - Y_UNUSED(name, value); - Y_ENSURE(false, "Not implemented"); - } -} + Y_UNUSED(name, value); + Y_ENSURE(false, "Not implemented"); + } +} diff --git a/library/cpp/monlib/metrics/metric_consumer.h b/library/cpp/monlib/metrics/metric_consumer.h index 74352103fa..f7a727585a 100644 --- a/library/cpp/monlib/metrics/metric_consumer.h +++ b/library/cpp/monlib/metrics/metric_consumer.h @@ -23,7 +23,7 @@ namespace NMonitoring { virtual void OnLabelsBegin() = 0; virtual void OnLabelsEnd() = 0; virtual void OnLabel(TStringBuf name, TStringBuf value) = 0; - virtual void OnLabel(ui32 name, ui32 value); + virtual void OnLabel(ui32 name, ui32 value); virtual std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value); virtual void OnDouble(TInstant time, double value) = 0; diff --git a/library/cpp/monlib/metrics/ya.make b/library/cpp/monlib/metrics/ya.make index a2ecf50df0..0e1fa143f9 100644 --- a/library/cpp/monlib/metrics/ya.make +++ b/library/cpp/monlib/metrics/ya.make @@ -17,7 +17,7 @@ SRCS( log_histogram_snapshot.cpp labels.cpp metric_registry.cpp - metric_consumer.cpp + metric_consumer.cpp metric_type.cpp metric_value.cpp summary_snapshot.cpp diff --git a/library/cpp/svnversion/test/main.cpp b/library/cpp/svnversion/test/main.cpp index fc1eeef11c..3c8209047f 100644 --- a/library/cpp/svnversion/test/main.cpp +++ b/library/cpp/svnversion/test/main.cpp @@ -24,7 +24,7 @@ int main() { Cout << "GetBranch(): " << GetBranch() << Endl; Cout << "GetTag(): " << GetTag() << Endl; Cout << "GetArcadiaPatchNumber(): " << GetArcadiaPatchNumber() << Endl; - Cout << "GetVCSDirty(): " << GetVCSDirty() << Endl; + Cout << "GetVCSDirty(): " << GetVCSDirty() << Endl; return 0; } diff --git a/library/cpp/ya.make b/library/cpp/ya.make index 032a9b37e3..8c1193b007 100644 --- a/library/cpp/ya.make +++ b/library/cpp/ya.make @@ -427,7 +427,7 @@ IF (OS_LINUX) balloc_market/test balloc_market/aba_agri_test ytalloc - rseq + rseq ) ENDIF() diff --git a/library/cpp/yt/memory/blob.cpp b/library/cpp/yt/memory/blob.cpp index 5b3be740bf..86000b033b 100644 --- a/library/cpp/yt/memory/blob.cpp +++ b/library/cpp/yt/memory/blob.cpp @@ -3,17 +3,17 @@ #include <library/cpp/ytalloc/api/ytalloc.h> -namespace NYT { - -//////////////////////////////////////////////////////////////////////////////// - +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + static constexpr size_t InitialBlobCapacity = 16; static constexpr double BlobCapacityMultiplier = 1.5; -TBlob::TBlob( - TRefCountedTypeCookie tagCookie, - size_t size, - bool initiailizeStorage, +TBlob::TBlob( + TRefCountedTypeCookie tagCookie, + size_t size, + bool initiailizeStorage, bool pageAligned) : PageAligned_(pageAligned) { @@ -29,8 +29,8 @@ TBlob::TBlob( } } -TBlob::TBlob( - TRefCountedTypeCookie tagCookie, +TBlob::TBlob( + TRefCountedTypeCookie tagCookie, TRef data, bool pageAligned) : PageAligned_(pageAligned) @@ -97,8 +97,8 @@ void TBlob::Resize(size_t newSize, bool initializeStorage /*= true*/) TBlob& TBlob::operator = (const TBlob& rhs) { if (this != &rhs) { - this->~TBlob(); - new(this) TBlob(rhs); + this->~TBlob(); + new(this) TBlob(rhs); } return *this; } @@ -106,8 +106,8 @@ TBlob& TBlob::operator = (const TBlob& rhs) TBlob& TBlob::operator = (TBlob&& rhs) noexcept { if (this != &rhs) { - this->~TBlob(); - new(this) TBlob(std::move(rhs)); + this->~TBlob(); + new(this) TBlob(std::move(rhs)); } return *this; } diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h index c250083957..3dead7db1d 100644 --- a/library/cpp/yt/memory/intrusive_ptr.h +++ b/library/cpp/yt/memory/intrusive_ptr.h @@ -6,7 +6,7 @@ #include <util/generic/utility.h> #include <utility> -#include <type_traits> +#include <type_traits> namespace NYT { @@ -21,7 +21,7 @@ public: constexpr TIntrusivePtr() noexcept { } - constexpr TIntrusivePtr(std::nullptr_t) noexcept + constexpr TIntrusivePtr(std::nullptr_t) noexcept { } //! Constructor from an unqualified reference. @@ -50,7 +50,7 @@ public: } //! Copy constructor with an upcast. - template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> + template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> TIntrusivePtr(const TIntrusivePtr<U>& other) noexcept : T_(other.Get()) { @@ -70,7 +70,7 @@ public: } //! Move constructor with an upcast. - template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> + template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> TIntrusivePtr(TIntrusivePtr<U>&& other) noexcept : T_(other.Get()) { @@ -100,7 +100,7 @@ public: TIntrusivePtr& operator=(const TIntrusivePtr<U>& other) noexcept { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); static_assert( std::is_base_of_v<TRefCountedBase, T>, @@ -121,7 +121,7 @@ public: TIntrusivePtr& operator=(TIntrusivePtr<U>&& other) noexcept { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); static_assert( std::is_base_of_v<TRefCountedBase, T>, @@ -271,7 +271,7 @@ template <class T, class U> bool operator==(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs.Get() == rhs.Get(); } @@ -280,7 +280,7 @@ template <class T, class U> bool operator!=(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs.Get() != rhs.Get(); } @@ -289,7 +289,7 @@ template <class T, class U> bool operator==(const TIntrusivePtr<T>& lhs, U* rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs.Get() == rhs; } @@ -298,7 +298,7 @@ template <class T, class U> bool operator!=(const TIntrusivePtr<T>& lhs, U* rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs.Get() != rhs; } @@ -307,7 +307,7 @@ template <class T, class U> bool operator==(T* lhs, const TIntrusivePtr<U>& rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs == rhs.Get(); } @@ -316,7 +316,7 @@ template <class T, class U> bool operator!=(T* lhs, const TIntrusivePtr<U>& rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs != rhs.Get(); } @@ -351,7 +351,7 @@ bool operator!=(const TIntrusivePtr<T>& lhs, std::nullptr_t) //! A hasher for TIntrusivePtr. template <class T> -struct THash<NYT::TIntrusivePtr<T>> +struct THash<NYT::TIntrusivePtr<T>> { Y_FORCE_INLINE size_t operator () (const NYT::TIntrusivePtr<T>& ptr) const { diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h index b4650930a5..25a242bb8a 100644 --- a/library/cpp/yt/memory/weak_ptr.h +++ b/library/cpp/yt/memory/weak_ptr.h @@ -43,7 +43,7 @@ public: { } //! Constructor from a strong reference with an upcast. - template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> + template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> TWeakPtr(const TIntrusivePtr<U>& ptr) noexcept : TWeakPtr(ptr.Get()) { @@ -58,7 +58,7 @@ public: { } //! Copy constructor with an upcast. - template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> + template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> TWeakPtr(const TWeakPtr<U>& other) noexcept : TWeakPtr(other.Lock()) { @@ -74,7 +74,7 @@ public: } //! Move constructor with an upcast. - template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> + template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>> TWeakPtr(TWeakPtr<U>&& other) noexcept { static_assert( @@ -103,7 +103,7 @@ public: TWeakPtr& operator=(const TIntrusivePtr<U>& ptr) noexcept { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); TWeakPtr(ptr).Swap(*this); return *this; @@ -121,7 +121,7 @@ public: TWeakPtr& operator=(const TWeakPtr<U>& other) noexcept { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); TWeakPtr(other).Swap(*this); return *this; @@ -139,7 +139,7 @@ public: TWeakPtr& operator=(TWeakPtr<U>&& other) noexcept { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); TWeakPtr(std::move(other)).Swap(*this); return *this; @@ -162,7 +162,7 @@ public: void Reset(const TIntrusivePtr<U>& ptr) // noexcept { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); TWeakPtr(ptr).Swap(*this); } @@ -210,7 +210,7 @@ private: template <class U> friend class TWeakPtr; template <class U> - friend struct ::THash; + friend struct ::THash; T* T_ = nullptr; #if defined(_tsan_enabled_) @@ -284,7 +284,7 @@ template <class T, class U> bool operator==(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs.Lock().Get() == rhs.Lock().Get(); } @@ -293,7 +293,7 @@ template <class T, class U> bool operator!=(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs) { static_assert( - std::is_convertible_v<U*, T*>, + std::is_convertible_v<U*, T*>, "U* must be convertible to T*"); return lhs.Lock().Get() != rhs.Lock().Get(); } @@ -305,7 +305,7 @@ bool operator!=(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs) //! A hasher for TWeakPtr. template <class T> -struct THash<NYT::TWeakPtr<T>> +struct THash<NYT::TWeakPtr<T>> { size_t operator () (const NYT::TWeakPtr<T>& ptr) const { diff --git a/library/cpp/yt/misc/guid-inl.h b/library/cpp/yt/misc/guid-inl.h index 472457eb6d..2d94b5701b 100644 --- a/library/cpp/yt/misc/guid-inl.h +++ b/library/cpp/yt/misc/guid-inl.h @@ -66,7 +66,7 @@ Y_FORCE_INLINE bool operator < (TGuid lhs, TGuid rhs) } // namespace NYT -Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const +Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const { const size_t p = 1000000009; // prime number return guid.Parts32[0] + diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp index 501b9630cb..882787d7a2 100644 --- a/library/cpp/yt/misc/guid.cpp +++ b/library/cpp/yt/misc/guid.cpp @@ -115,28 +115,28 @@ bool TGuid::FromStringHex32(TStringBuf str, TGuid* result) return false; } - bool ok = true; - int i = 0; - auto parseChar = [&] { - const char c = str[i++]; - ui32 digit = 0; - if ('0' <= c && c <= '9') { - digit = c - '0'; - } else if ('a' <= c && c <= 'f') { - digit = c - 'a' + 10; - } else if ('A' <= c && c <= 'F') { - digit = c - 'A' + 10; - } else { - ok = false; - } - return digit; - }; - - for (size_t j = 0; j < 16; ++j) { - result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar(); + bool ok = true; + int i = 0; + auto parseChar = [&] { + const char c = str[i++]; + ui32 digit = 0; + if ('0' <= c && c <= '9') { + digit = c - '0'; + } else if ('a' <= c && c <= 'f') { + digit = c - 'a' + 10; + } else if ('A' <= c && c <= 'F') { + digit = c - 'A' + 10; + } else { + ok = false; + } + return digit; + }; + + for (size_t j = 0; j < 16; ++j) { + result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar(); } - return ok; + return ok; } char* WriteGuidToBuffer(char* ptr, TGuid value) diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h index e202e1e679..ec4ba3526a 100644 --- a/library/cpp/yt/misc/guid.h +++ b/library/cpp/yt/misc/guid.h @@ -9,39 +9,39 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// -//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers. -/*! - * *-------------------------*-------------------------* - * | Parts64[0] | Parts64[1] | - * *------------*------------*------------*------------* - * | Parts32[0] | Parts32[1] | Parts32[2] | Parts32[3] | - * *------------*------------*------------*------------* - * | 15..............................................0 | - * *---------------------------------------------------* - * - * Note, that bytes are kept in memory in reverse order. - * - * Canonical text representation of guid consists of four base-16 numbers. - * In text form, Parts32[3] comes first, and Parts32[0] comes last. - * - * For example: - * - * xxyyzzaa-0-1234-ff - * - * xx is byte [0] - * yy is byte [1] - * zz is byte [2] - * 12 is byte [8] - * 34 is byte [9] - * ff is byte [15] - */ +//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers. +/*! + * *-------------------------*-------------------------* + * | Parts64[0] | Parts64[1] | + * *------------*------------*------------*------------* + * | Parts32[0] | Parts32[1] | Parts32[2] | Parts32[3] | + * *------------*------------*------------*------------* + * | 15..............................................0 | + * *---------------------------------------------------* + * + * Note, that bytes are kept in memory in reverse order. + * + * Canonical text representation of guid consists of four base-16 numbers. + * In text form, Parts32[3] comes first, and Parts32[0] comes last. + * + * For example: + * + * xxyyzzaa-0-1234-ff + * + * xx is byte [0] + * yy is byte [1] + * zz is byte [2] + * 12 is byte [8] + * 34 is byte [9] + * ff is byte [15] + */ struct TGuid { union { ui32 Parts32[4]; ui64 Parts64[2]; - ui8 ReversedParts8[16]; + ui8 ReversedParts8[16]; }; //! Constructs a null (zero) guid. @@ -97,7 +97,7 @@ Y_DECLARE_PODTYPE(NYT::TGuid); //! A hasher for TGuid. template <> -struct THash<NYT::TGuid> +struct THash<NYT::TGuid> { size_t operator()(const NYT::TGuid& guid) const; }; diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h index 88335abf40..b24ac50995 100644 --- a/library/cpp/yt/misc/port.h +++ b/library/cpp/yt/misc/port.h @@ -32,7 +32,7 @@ #endif // Configure SSE usage. -#ifdef SSE42_ENABLED +#ifdef SSE42_ENABLED #define YT_USE_SSE42 #endif diff --git a/library/cpp/yt/misc/variant.h b/library/cpp/yt/misc/variant.h index a1fd8bedf1..27c0a2bc08 100644 --- a/library/cpp/yt/misc/variant.h +++ b/library/cpp/yt/misc/variant.h @@ -31,9 +31,9 @@ class TStringBuilderBase; template <class... Ts> void FormatValue(TStringBuilderBase* builder, const std::variant<Ts...>& variant, TStringBuf spec); -template <class... Ts> +template <class... Ts> TString ToString(const std::variant<Ts...>& variant); - + //////////////////////////////////////////////////////////////////////////////// //! A concise way of creating a functor with an overloaded operator(). diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h index eb35a2df51..2ca8713ea7 100644 --- a/library/cpp/yt/small_containers/compact_set.h +++ b/library/cpp/yt/small_containers/compact_set.h @@ -50,7 +50,7 @@ public: TCompactSet() {} [[nodiscard]] bool empty() const; - + size_type size() const; const T& front() const; diff --git a/library/cpp/yt/small_containers/compact_vector-inl.h b/library/cpp/yt/small_containers/compact_vector-inl.h index d712f5a8fe..52507e4768 100644 --- a/library/cpp/yt/small_containers/compact_vector-inl.h +++ b/library/cpp/yt/small_containers/compact_vector-inl.h @@ -734,7 +734,7 @@ void TCompactVector<T, N>::EnsureOnHeapCapacity(size_t newCapacity, bool increme } auto byteSize = sizeof(TOnHeapStorage) + newCapacity * sizeof(T); - byteSize = nallocx(byteSize, 0); + byteSize = nallocx(byteSize, 0); newCapacity = (byteSize - sizeof(TOnHeapStorage)) / sizeof(T); diff --git a/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp b/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp index 012f31195f..0b2f290692 100644 --- a/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp +++ b/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp @@ -1,4 +1,4 @@ -#include <yt/yt/core/test_framework/framework.h> +#include <yt/yt/core/test_framework/framework.h> #include <yt/yt/core/misc/compact_flat_map.h> diff --git a/library/cpp/yt/string/unittests/guid_ut.cpp b/library/cpp/yt/string/unittests/guid_ut.cpp index 629f56ff1a..4b5eebea16 100644 --- a/library/cpp/yt/string/unittests/guid_ut.cpp +++ b/library/cpp/yt/string/unittests/guid_ut.cpp @@ -3,8 +3,8 @@ #include <library/cpp/yt/string/guid.h> #include <library/cpp/yt/string/format.h> -#include <util/string/hex.h> - +#include <util/string/hex.h> + namespace NYT { namespace { @@ -21,10 +21,10 @@ TString CanonicalToString(TGuid value) value.Parts32[0]); } -const ui32 TrickyValues[] = { - 0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678 -}; - +const ui32 TrickyValues[] = { + 0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678 +}; + TEST(TGuidTest, FormatAllTricky) { for (ui32 a : TrickyValues) { @@ -44,14 +44,14 @@ TEST(TGuidTest, FormatAllSymbols) const auto Value = TGuid::FromString("12345678-abcdef01-12345678-abcdef01"); EXPECT_EQ(CanonicalToString(Value), ToString(Value)); } - -TEST(TGuidTest, ByteOrder) -{ - auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01"); - TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16}; - EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412"); -} - + +TEST(TGuidTest, ByteOrder) +{ + auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01"); + TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16}; + EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412"); +} + //////////////////////////////////////////////////////////////////////////////// } // namespace diff --git a/library/cpp/ytalloc/api/fallback.cpp b/library/cpp/ytalloc/api/fallback.cpp index a729e46f3b..5880ede439 100644 --- a/library/cpp/ytalloc/api/fallback.cpp +++ b/library/cpp/ytalloc/api/fallback.cpp @@ -21,10 +21,10 @@ Y_WEAK void* AllocatePageAligned(size_t size) { #if defined(_win_) return ::_aligned_malloc(size, PageSize); -#elif defined(_darwin_) || !defined(_musl_) - return ::valloc(size); +#elif defined(_darwin_) || !defined(_musl_) + return ::valloc(size); #else - return ::memalign(PageSize, size); + return ::memalign(PageSize, size); #endif } diff --git a/library/cpp/ytalloc/api/ytalloc.h b/library/cpp/ytalloc/api/ytalloc.h index 1088fec177..d942dde638 100644 --- a/library/cpp/ytalloc/api/ytalloc.h +++ b/library/cpp/ytalloc/api/ytalloc.h @@ -190,7 +190,7 @@ void SetBacktraceFormatter(TBacktraceFormatter provider); //! Typically invoked on application startup to lock all binaries in memory //! and prevent executable code and static data to be paged out //! causing latency spikes. -void MlockFileMappings(bool populate = true); +void MlockFileMappings(bool populate = true); //////////////////////////////////////////////////////////////////////////////// // Configuration API @@ -349,7 +349,7 @@ DEFINE_ENUM(ETimingEventType, (MadviseDontNeed) (Locking) (Prefault) - (FilePrefault) + (FilePrefault) ); struct TTimingEventCounters diff --git a/library/cpp/ytalloc/ya.make b/library/cpp/ytalloc/ya.make index f0771169f7..97aa73c135 100644 --- a/library/cpp/ytalloc/ya.make +++ b/library/cpp/ytalloc/ya.make @@ -12,6 +12,6 @@ RECURSE( IF (YT_ALLOC_ENABLED) RECURSE( ut - benchmarks + benchmarks ) ENDIF() |