diff options
author | halin-george <halin-george@yandex-team.ru> | 2022-02-10 16:50:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:07 +0300 |
commit | 811c91d683d6123a2aa69baa10b30184f5e1204d (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 7c7a0655bcf00449b1fcacc2c658cc4d5c3aca7b (diff) | |
download | ydb-811c91d683d6123a2aa69baa10b30184f5e1204d.tar.gz |
Restoring authorship annotation for <halin-george@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | library/cpp/coroutine/engine/impl.cpp | 2 | ||||
-rw-r--r-- | library/cpp/coroutine/engine/impl.h | 6 | ||||
-rw-r--r-- | library/cpp/coroutine/engine/trampoline.cpp | 2 | ||||
-rw-r--r-- | library/cpp/monlib/metrics/labels.h | 232 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/task_scheduler.cpp | 6 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/task_scheduler_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/ut/ya.make | 16 | ||||
-rw-r--r-- | library/cpp/threading/task_scheduler/ya.make | 18 | ||||
-rw-r--r-- | library/cpp/yt/memory/ref_counted-inl.h | 4 | ||||
-rw-r--r-- | library/cpp/yt/yson_string/string.cpp | 6 | ||||
-rw-r--r-- | library/cpp/yt/yson_string/string.h | 4 | ||||
-rw-r--r-- | util/system/context.cpp | 2 | ||||
-rw-r--r-- | util/system/context.h | 2 | ||||
-rw-r--r-- | util/system/sanitizers.cpp | 56 | ||||
-rw-r--r-- | util/system/sanitizers.h | 10 |
15 files changed, 184 insertions, 184 deletions
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp index ca532690a7..7ae6f74051 100644 --- a/library/cpp/coroutine/engine/impl.cpp +++ b/library/cpp/coroutine/engine/impl.cpp @@ -24,7 +24,7 @@ TCont::TCont(NCoro::NStack::IAllocator& allocator, NCoro::TTrampoline::TFunc func, const char* name) noexcept : Executor_(executor) - , Name_(name) + , Name_(name) , Trampoline_( allocator, stackSize, diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h index 4154029c07..283a96ecf1 100644 --- a/library/cpp/coroutine/engine/impl.h +++ b/library/cpp/coroutine/engine/impl.h @@ -113,9 +113,9 @@ private: // TODO(velavokr): allow name storage owning (for generated names backed by TString) const char* Name_ = nullptr; - - NCoro::TTrampoline Trampoline_; - + + NCoro::TTrampoline Trampoline_; + TIntrusiveList<TJoinWait> Waiters_; bool Cancelled_ = false; bool Scheduled_ = false; diff --git a/library/cpp/coroutine/engine/trampoline.cpp b/library/cpp/coroutine/engine/trampoline.cpp index 103177efef..10ea69ddc3 100644 --- a/library/cpp/coroutine/engine/trampoline.cpp +++ b/library/cpp/coroutine/engine/trampoline.cpp @@ -16,7 +16,7 @@ namespace NCoro { TTrampoline::TTrampoline(NStack::IAllocator& allocator, ui32 stackSize, TFunc f, TCont* cont) noexcept : Stack_(allocator, stackSize, cont->Name()) - , Clo_{this, Stack_.Get(), cont->Name()} + , Clo_{this, Stack_.Get(), cont->Name()} , Ctx_(Clo_) , Func_(std::move(f)) , Cont_(cont) diff --git a/library/cpp/monlib/metrics/labels.h b/library/cpp/monlib/metrics/labels.h index 285515cb9c..63dc997c28 100644 --- a/library/cpp/monlib/metrics/labels.h +++ b/library/cpp/monlib/metrics/labels.h @@ -192,40 +192,40 @@ namespace NMonitoring { // TLabels /////////////////////////////////////////////////////////////////////////// template <typename TStringBackend> - class TLabelsImpl: public ILabels { + class TLabelsImpl: public ILabels { public: - using value_type = TLabelImpl<TStringBackend>; - - TLabelsImpl() = default; - - explicit TLabelsImpl(::NDetail::TReserveTag rt) - : Labels_(std::move(rt)) - {} - - explicit TLabelsImpl(size_t count) - : Labels_(count) - {} - - explicit TLabelsImpl(size_t count, const value_type& label) - : Labels_(count, label) - {} - - TLabelsImpl(std::initializer_list<value_type> il) - : Labels_(std::move(il)) - {} - - TLabelsImpl(const TLabelsImpl&) = default; - TLabelsImpl& operator=(const TLabelsImpl&) = default; - - TLabelsImpl(TLabelsImpl&&) noexcept = default; - TLabelsImpl& operator=(TLabelsImpl&&) noexcept = default; - + using value_type = TLabelImpl<TStringBackend>; + + TLabelsImpl() = default; + + explicit TLabelsImpl(::NDetail::TReserveTag rt) + : Labels_(std::move(rt)) + {} + + explicit TLabelsImpl(size_t count) + : Labels_(count) + {} + + explicit TLabelsImpl(size_t count, const value_type& label) + : Labels_(count, label) + {} + + TLabelsImpl(std::initializer_list<value_type> il) + : Labels_(std::move(il)) + {} + + TLabelsImpl(const TLabelsImpl&) = default; + TLabelsImpl& operator=(const TLabelsImpl&) = default; + + TLabelsImpl(TLabelsImpl&&) noexcept = default; + TLabelsImpl& operator=(TLabelsImpl&&) noexcept = default; + inline bool operator==(const TLabelsImpl& rhs) const { - return Labels_ == rhs.Labels_; + return Labels_ == rhs.Labels_; } inline bool operator!=(const TLabelsImpl& rhs) const { - return Labels_ != rhs.Labels_; + return Labels_ != rhs.Labels_; } bool Add(TStringBuf name, TStringBuf value) noexcept override { @@ -233,43 +233,43 @@ namespace NMonitoring { return false; } - Labels_.emplace_back(name, value); + Labels_.emplace_back(name, value); return true; } using ILabels::Add; bool Has(TStringBuf name) const noexcept override { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - return it != Labels_.end(); + return it != Labels_.end(); } bool Has(const TString& name) const noexcept { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - return it != Labels_.end(); + return it != Labels_.end(); } // XXX for backward compatibility TMaybe<TLabelImpl<TStringBackend>> Find(TStringBuf name) const { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - if (it == Labels_.end()) { + if (it == Labels_.end()) { return Nothing(); } return *it; } std::optional<const ILabel*> Get(TStringBuf name) const override { - auto it = FindIf(Labels_, [name] (auto&& l) { + auto it = FindIf(Labels_, [name] (auto&& l) { return name == l.Name(); }); - if (it == Labels_.end()) { + if (it == Labels_.end()) { return {}; } @@ -281,116 +281,116 @@ namespace NMonitoring { } TMaybe<TLabelImpl<TStringBackend>> Extract(TStringBuf name) { - auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { + auto it = FindIf(Labels_, [name](const TLabelImpl<TStringBackend>& label) { return name == TStringBuf{label.Name()}; }); - if (it == Labels_.end()) { + if (it == Labels_.end()) { return Nothing(); } TLabel tmp = *it; - Labels_.erase(it); + Labels_.erase(it); return tmp; } void SortByName() { - std::sort(Labels_.begin(), Labels_.end(), [](const auto& lhs, const auto& rhs) { + std::sort(Labels_.begin(), Labels_.end(), [](const auto& lhs, const auto& rhs) { return lhs.Name() < rhs.Name(); }); } inline size_t Hash() const noexcept override { - return TSimpleRangeHash()(Labels_); + return TSimpleRangeHash()(Labels_); } inline TLabel* Data() const noexcept { - return const_cast<TLabel*>(Labels_.data()); + return const_cast<TLabel*>(Labels_.data()); } inline size_t Size() const noexcept override { - return Labels_.size(); + return Labels_.size(); } inline bool Empty() const noexcept override { - return Labels_.empty(); + return Labels_.empty(); } inline void Clear() noexcept override { - Labels_.clear(); + Labels_.clear(); }; - TLabelImpl<TStringBackend>& front() { - return Labels_.front(); - } - - const TLabelImpl<TStringBackend>& front() const { - return Labels_.front(); - } - - TLabelImpl<TStringBackend>& back() { - return Labels_.back(); - } - - const TLabelImpl<TStringBackend>& back() const { - return Labels_.back(); - } - - TLabelImpl<TStringBackend>& operator[](size_t index) { - return Labels_[index]; - } - - const TLabelImpl<TStringBackend>& operator[](size_t index) const { - return Labels_[index]; - } - - TLabelImpl<TStringBackend>& at(size_t index) { - return Labels_.at(index); - } - - const TLabelImpl<TStringBackend>& at(size_t index) const { - return Labels_.at(index); - } - - size_t capacity() const { - return Labels_.capacity(); - } - - TLabelImpl<TStringBackend>* data() { - return Labels_.data(); - } - - const TLabelImpl<TStringBackend>* data() const { - return Labels_.data(); - } - - size_t size() const { - return Labels_.size(); - } - - bool empty() const { - return Labels_.empty(); - } - - void clear() { - Labels_.clear(); - } - - using ILabels::begin; - using ILabels::end; - - using iterator = ILabels::TIterator; - using const_iterator = iterator; - + TLabelImpl<TStringBackend>& front() { + return Labels_.front(); + } + + const TLabelImpl<TStringBackend>& front() const { + return Labels_.front(); + } + + TLabelImpl<TStringBackend>& back() { + return Labels_.back(); + } + + const TLabelImpl<TStringBackend>& back() const { + return Labels_.back(); + } + + TLabelImpl<TStringBackend>& operator[](size_t index) { + return Labels_[index]; + } + + const TLabelImpl<TStringBackend>& operator[](size_t index) const { + return Labels_[index]; + } + + TLabelImpl<TStringBackend>& at(size_t index) { + return Labels_.at(index); + } + + const TLabelImpl<TStringBackend>& at(size_t index) const { + return Labels_.at(index); + } + + size_t capacity() const { + return Labels_.capacity(); + } + + TLabelImpl<TStringBackend>* data() { + return Labels_.data(); + } + + const TLabelImpl<TStringBackend>* data() const { + return Labels_.data(); + } + + size_t size() const { + return Labels_.size(); + } + + bool empty() const { + return Labels_.empty(); + } + + void clear() { + Labels_.clear(); + } + + using ILabels::begin; + using ILabels::end; + + using iterator = ILabels::TIterator; + using const_iterator = iterator; + protected: - TVector<TLabelImpl<TStringBackend>>& AsVector() { - return Labels_; + TVector<TLabelImpl<TStringBackend>>& AsVector() { + return Labels_; } - const TVector<TLabelImpl<TStringBackend>>& AsVector() const { - return Labels_; + const TVector<TLabelImpl<TStringBackend>>& AsVector() const { + return Labels_; } - - private: - TVector<TLabelImpl<TStringBackend>> Labels_; + + private: + TVector<TLabelImpl<TStringBackend>> Labels_; }; using TLabels = TLabelsImpl<TString>; diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp index fc6c6c3082..174dde4bf7 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp @@ -1,4 +1,4 @@ -#include "task_scheduler.h" +#include "task_scheduler.h" #include <util/system/thread.h> #include <util/string/cast.h> @@ -44,7 +44,7 @@ TTaskScheduler::~TTaskScheduler() { try { Stop(); } catch (...) { - Cdbg << "task scheduled destruction error: " << CurrentExceptionMessage(); + Cdbg << "task scheduled destruction error: " << CurrentExceptionMessage(); } } @@ -201,7 +201,7 @@ void TTaskScheduler::WorkerFunc(TWorkerThread* thread) { try { repeat = toDo->Process(); } catch (...) { - Cdbg << "task scheduler error: " << CurrentExceptionMessage(); + Cdbg << "task scheduler error: " << CurrentExceptionMessage(); } } diff --git a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp index 28c6983ca2..3b5203194a 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp @@ -5,7 +5,7 @@ #include <util/system/atomic.h> #include <util/generic/vector.h> -#include "task_scheduler.h" +#include "task_scheduler.h" class TTaskSchedulerTest: public TTestBase { UNIT_TEST_SUITE(TTaskSchedulerTest); diff --git a/library/cpp/threading/task_scheduler/ut/ya.make b/library/cpp/threading/task_scheduler/ut/ya.make index 4696c290dd..07ee8b0877 100644 --- a/library/cpp/threading/task_scheduler/ut/ya.make +++ b/library/cpp/threading/task_scheduler/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/threading/task_scheduler) - -OWNER(g:middle) - -SRCS( - task_scheduler_ut.cpp -) - -END() + +OWNER(g:middle) + +SRCS( + task_scheduler_ut.cpp +) + +END() diff --git a/library/cpp/threading/task_scheduler/ya.make b/library/cpp/threading/task_scheduler/ya.make index 2964c97984..5b14c0aa63 100644 --- a/library/cpp/threading/task_scheduler/ya.make +++ b/library/cpp/threading/task_scheduler/ya.make @@ -1,9 +1,9 @@ -LIBRARY() - -OWNER(g:middle) - -SRCS( - task_scheduler.cpp -) - -END() +LIBRARY() + +OWNER(g:middle) + +SRCS( + task_scheduler.cpp +) + +END() diff --git a/library/cpp/yt/memory/ref_counted-inl.h b/library/cpp/yt/memory/ref_counted-inl.h index 3cbeb65703..e6d64fec18 100644 --- a/library/cpp/yt/memory/ref_counted-inl.h +++ b/library/cpp/yt/memory/ref_counted-inl.h @@ -71,7 +71,7 @@ Y_FORCE_INLINE int TRefCounter::GetRefCount() const noexcept Y_FORCE_INLINE void TRefCounter::Ref() const noexcept { - // It is safe to use relaxed here, since new reference is always created from another live reference. + // It is safe to use relaxed here, since new reference is always created from another live reference. StrongCount_.fetch_add(1, std::memory_order_relaxed); YT_ASSERT(WeakCount_.load(std::memory_order_relaxed) > 0); @@ -93,7 +93,7 @@ Y_FORCE_INLINE bool TRefCounter::Unref() const // // See http://www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html#boost_atomic.usage_examples.example_reference_counters // - auto oldStrongCount = StrongCount_.fetch_sub(1, std::memory_order_release); + auto oldStrongCount = StrongCount_.fetch_sub(1, std::memory_order_release); YT_ASSERT(oldStrongCount > 0); if (oldStrongCount == 1) { StrongCount_.load(std::memory_order_acquire); diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp index b6880e1e03..99d45e8616 100644 --- a/library/cpp/yt/yson_string/string.cpp +++ b/library/cpp/yt/yson_string/string.cpp @@ -34,10 +34,10 @@ TYsonStringBuf::TYsonStringBuf(const TString& data, EYsonType type) TYsonStringBuf::TYsonStringBuf(TStringBuf data, EYsonType type) : Data_(data) - , Type_(type) + , Type_(type) , Null_(false) -{ } - +{ } + TYsonStringBuf::TYsonStringBuf(const char* data, EYsonType type) : TYsonStringBuf(TStringBuf(data), type) { } diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h index cf649e39aa..e13af37a6d 100644 --- a/library/cpp/yt/yson_string/string.h +++ b/library/cpp/yt/yson_string/string.h @@ -29,8 +29,8 @@ public: //! Constructs a non-null instance with given type and content. explicit TYsonStringBuf( TStringBuf data, - EYsonType type = EYsonType::Node); - + EYsonType type = EYsonType::Node); + //! Constructs a non-null instance with given type and content //! (without this overload there is no way to construct TYsonStringBuf from //! string literal). diff --git a/util/system/context.cpp b/util/system/context.cpp index 4326e5cd6b..ad99309088 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -140,7 +140,7 @@ TContMachineContext::TSan::TSan() noexcept } TContMachineContext::TSan::TSan(const TContClosure& c) noexcept - : NSan::TFiberContext(c.Stack.data(), c.Stack.size(), c.ContName) + : NSan::TFiberContext(c.Stack.data(), c.Stack.size(), c.ContName) , TL(c.TrampoLine) { } diff --git a/util/system/context.h b/util/system/context.h index 6f52a42e0b..d2a349bfc5 100644 --- a/util/system/context.h +++ b/util/system/context.h @@ -54,7 +54,7 @@ struct ITrampoLine { struct TContClosure { ITrampoLine* TrampoLine; TArrayRef<char> Stack; - const char* ContName = nullptr; + const char* ContName = nullptr; }; #if defined(USE_UCONTEXT_CONT) diff --git a/util/system/sanitizers.cpp b/util/system/sanitizers.cpp index 5fa80de4f1..bb799a9e2e 100644 --- a/util/system/sanitizers.cpp +++ b/util/system/sanitizers.cpp @@ -8,17 +8,17 @@ extern "C" { } #endif -#if defined(_tsan_enabled_) +#if defined(_tsan_enabled_) #if defined(__clang_major__) && (__clang_major__ >= 9) -extern "C" { +extern "C" { void* __tsan_get_current_fiber(void); void* __tsan_create_fiber(unsigned flags); void __tsan_destroy_fiber(void* fiber); void __tsan_switch_to_fiber(void* fiber, unsigned flags); void __tsan_set_fiber_name(void* fiber, const char* name); -} +} #else -namespace { +namespace { void* __tsan_get_current_fiber(void) { return nullptr; } @@ -31,43 +31,43 @@ namespace { } void __tsan_set_fiber_name(void*, const char*) { } -} +} #endif -#endif - +#endif + using namespace NSan; TFiberContext::TFiberContext() noexcept : Token_(nullptr) , IsMainFiber_(true) -#if defined(_tsan_enabled_) - , CurrentTSanFiberContext_(__tsan_get_current_fiber()) -#endif +#if defined(_tsan_enabled_) + , CurrentTSanFiberContext_(__tsan_get_current_fiber()) +#endif { TCurrentThreadLimits sl; Stack_ = sl.StackBegin; Len_ = sl.StackLength; - -#if defined(_tsan_enabled_) - static constexpr char MainFiberName[] = "main_fiber"; - __tsan_set_fiber_name(CurrentTSanFiberContext_, MainFiberName); -#endif + +#if defined(_tsan_enabled_) + static constexpr char MainFiberName[] = "main_fiber"; + __tsan_set_fiber_name(CurrentTSanFiberContext_, MainFiberName); +#endif } -TFiberContext::TFiberContext(const void* stack, size_t len, const char* contName) noexcept +TFiberContext::TFiberContext(const void* stack, size_t len, const char* contName) noexcept : Token_(nullptr) , Stack_(stack) , Len_(len) , IsMainFiber_(false) -#if defined(_tsan_enabled_) +#if defined(_tsan_enabled_) , CurrentTSanFiberContext_(__tsan_create_fiber(/*flags =*/0)) -#endif +#endif { - (void)contName; -#if defined(_tsan_enabled_) - __tsan_set_fiber_name(CurrentTSanFiberContext_, contName); -#endif + (void)contName; +#if defined(_tsan_enabled_) + __tsan_set_fiber_name(CurrentTSanFiberContext_, contName); +#endif } TFiberContext::~TFiberContext() noexcept { @@ -84,10 +84,10 @@ TFiberContext::~TFiberContext() noexcept { __sanitizer_finish_switch_fiber(activeFakeStack, nullptr, nullptr); } #endif -#if defined(_tsan_enabled_) - __tsan_destroy_fiber(CurrentTSanFiberContext_); +#if defined(_tsan_enabled_) + __tsan_destroy_fiber(CurrentTSanFiberContext_); #endif - } + } } void TFiberContext::BeforeFinish() noexcept { @@ -106,10 +106,10 @@ void TFiberContext::BeforeSwitch(TFiberContext* old) noexcept { #else (void)old; #endif - -#if defined(_tsan_enabled_) + +#if defined(_tsan_enabled_) __tsan_switch_to_fiber(CurrentTSanFiberContext_, /*flags =*/0); -#endif +#endif } void TFiberContext::AfterSwitch() noexcept { diff --git a/util/system/sanitizers.h b/util/system/sanitizers.h index 315d461bc2..965e5c751e 100644 --- a/util/system/sanitizers.h +++ b/util/system/sanitizers.h @@ -20,7 +20,7 @@ namespace NSan { class TFiberContext { public: TFiberContext() noexcept; - TFiberContext(const void* stack, size_t len, const char* contName) noexcept; + TFiberContext(const void* stack, size_t len, const char* contName) noexcept; ~TFiberContext() noexcept; @@ -34,11 +34,11 @@ namespace NSan { void* Token_; const void* Stack_; size_t Len_; - + const bool IsMainFiber_; -#if defined(_tsan_enabled_) - void* const CurrentTSanFiberContext_; -#endif +#if defined(_tsan_enabled_) + void* const CurrentTSanFiberContext_; +#endif }; // Returns plain if no sanitizer enabled or sanitized otherwise |