diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-12-10 10:56:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-10 10:56:20 +0000 |
commit | d8dfdbf4d73848a69f6448c54c40772d32768ce0 (patch) | |
tree | 6303b41fd780afed2ab32d80b2488cb60157fe74 /library/cpp | |
parent | 68a09a089224c4107f82e7ac6053dc91f7eee04f (diff) | |
parent | 0087d863d95f4ab0c1f378fc9406b87ab334924c (diff) | |
download | ydb-d8dfdbf4d73848a69f6448c54c40772d32768ce0.tar.gz |
Merge pull request #12445 from ydb-platform/mergelibs-241210-0813
Library import 241210-0813
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/tld/tlds-alpha-by-domain.txt | 2 | ||||
-rw-r--r-- | library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.cpp | 51 | ||||
-rw-r--r-- | library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.h | 13 | ||||
-rw-r--r-- | library/cpp/yt/backtrace/absl_unwinder/ya.make | 14 | ||||
-rw-r--r-- | library/cpp/yt/memory/non_null_ptr-inl.h (renamed from library/cpp/yt/misc/non_null_ptr-inl.h) | 0 | ||||
-rw-r--r-- | library/cpp/yt/memory/non_null_ptr.h (renamed from library/cpp/yt/misc/non_null_ptr.h) | 7 | ||||
-rw-r--r-- | library/cpp/yt/memory/unittests/non_null_ptr_ut.cpp (renamed from library/cpp/yt/misc/unittests/non_null_ptr_ut.cpp) | 2 | ||||
-rw-r--r-- | library/cpp/yt/memory/unittests/ya.make | 5 | ||||
-rw-r--r-- | library/cpp/yt/misc/concepts.h | 2 | ||||
-rw-r--r-- | library/cpp/yt/misc/unittests/ya.make | 1 | ||||
-rw-r--r-- | library/cpp/yt/stockpile/stockpile_linux.cpp | 14 | ||||
-rw-r--r-- | library/cpp/yt/ya_cpp.make.inc | 1 |
12 files changed, 95 insertions, 17 deletions
diff --git a/library/cpp/tld/tlds-alpha-by-domain.txt b/library/cpp/tld/tlds-alpha-by-domain.txt index 4abc83be313..eda39f07a64 100644 --- a/library/cpp/tld/tlds-alpha-by-domain.txt +++ b/library/cpp/tld/tlds-alpha-by-domain.txt @@ -1,4 +1,4 @@ -# Version 2024120400, Last Updated Wed Dec 4 07:07:01 2024 UTC +# Version 2024120700, Last Updated Sat Dec 7 07:07:01 2024 UTC AAA AARP ABB diff --git a/library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.cpp b/library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.cpp new file mode 100644 index 00000000000..429598e3b16 --- /dev/null +++ b/library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.cpp @@ -0,0 +1,51 @@ +#include "absl_unwinder.h" + +#include <library/cpp/yt/backtrace/cursors/libunwind/libunwind_cursor.h> + +#include <absl/debugging/stacktrace.h> + +namespace NYT::NBacktrace { + +//////////////////////////////////////////////////////////////////////////////// + +namespace { + +int AbslStackUnwinder( + void** frames, + int* /*framesSizes*/, + int maxFrames, + int skipFrames, + const void* /*uc*/, + int* /*minDroppedFrames*/) +{ + NBacktrace::TLibunwindCursor cursor; + + for (int i = 0; i < skipFrames + 1; ++i) { + cursor.MoveNext(); + } + + int count = 0; + for (int i = 0; i < maxFrames; ++i) { + if (cursor.IsFinished()) { + return count; + } + + // IP point's to return address. Subtract 1 to get accurate line information for profiler. + frames[i] = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(cursor.GetCurrentIP()) - 1); + count++; + + cursor.MoveNext(); + } + return count; +} + +} // namespace + +void SetAbslStackUnwinder() +{ + absl::SetStackUnwinder(AbslStackUnwinder); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NBacktrace diff --git a/library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.h b/library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.h new file mode 100644 index 00000000000..9a23c582c53 --- /dev/null +++ b/library/cpp/yt/backtrace/absl_unwinder/absl_unwinder.h @@ -0,0 +1,13 @@ +#pragma once + +namespace NYT::NBacktrace { + +//////////////////////////////////////////////////////////////////////////////// + +//! Configures Abseil to use a libunwind-based stack unwinder. +//! This is useful, e.g., for collecting TCMalloc heap dumps. +void SetAbslStackUnwinder(); + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT::NBacktrace diff --git a/library/cpp/yt/backtrace/absl_unwinder/ya.make b/library/cpp/yt/backtrace/absl_unwinder/ya.make new file mode 100644 index 00000000000..f6bb0fbb5a6 --- /dev/null +++ b/library/cpp/yt/backtrace/absl_unwinder/ya.make @@ -0,0 +1,14 @@ +LIBRARY() + +INCLUDE(${ARCADIA_ROOT}/library/cpp/yt/ya_cpp.make.inc) + +SRCS( + absl_unwinder.cpp +) + +PEERDIR( + library/cpp/yt/backtrace/cursors/libunwind + contrib/libs/tcmalloc/malloc_extension +) + +END() diff --git a/library/cpp/yt/misc/non_null_ptr-inl.h b/library/cpp/yt/memory/non_null_ptr-inl.h index a14b1e93020..a14b1e93020 100644 --- a/library/cpp/yt/misc/non_null_ptr-inl.h +++ b/library/cpp/yt/memory/non_null_ptr-inl.h diff --git a/library/cpp/yt/misc/non_null_ptr.h b/library/cpp/yt/memory/non_null_ptr.h index 0005e4edb66..f5992216c6a 100644 --- a/library/cpp/yt/misc/non_null_ptr.h +++ b/library/cpp/yt/memory/non_null_ptr.h @@ -1,6 +1,6 @@ #pragma once -#include "concepts.h" +#include <library/cpp/yt/misc/concepts.h> namespace NYT { @@ -52,21 +52,20 @@ template <CConst T> class TNonNullPtr<T> : public TNonNullPtrBase<T> { - using TMutPtr = TNonNullPtr<std::remove_const_t<T>>; + using TMutablePtr = TNonNullPtr<std::remove_const_t<T>>; using TNonNullPtrBase<T>::TNonNullPtrBase; friend TNonNullPtr<T> GetPtr<T>(T& ref) noexcept; public: - TNonNullPtr(TMutPtr mutPtr) noexcept + TNonNullPtr(TMutablePtr mutPtr) noexcept : TNonNullPtrBase<T>() { TNonNullPtrBase<T>::Ptr_ = mutPtr.Ptr_; } }; - //////////////////////////////////////////////////////////////////////////////// } // namespace NYT diff --git a/library/cpp/yt/misc/unittests/non_null_ptr_ut.cpp b/library/cpp/yt/memory/unittests/non_null_ptr_ut.cpp index 8396e403abc..c8e2e993fb2 100644 --- a/library/cpp/yt/misc/unittests/non_null_ptr_ut.cpp +++ b/library/cpp/yt/memory/unittests/non_null_ptr_ut.cpp @@ -1,6 +1,6 @@ #include <library/cpp/testing/gtest/gtest.h> -#include <library/cpp/yt/misc/non_null_ptr.h> +#include <library/cpp/yt/memory/non_null_ptr.h> namespace NYT { namespace { diff --git a/library/cpp/yt/memory/unittests/ya.make b/library/cpp/yt/memory/unittests/ya.make index 708586d651d..40443b6c0c7 100644 --- a/library/cpp/yt/memory/unittests/ya.make +++ b/library/cpp/yt/memory/unittests/ya.make @@ -11,11 +11,12 @@ SRCS( free_list_ut.cpp function_view_ut.cpp intrusive_ptr_ut.cpp - shared_range_ut.cpp - weak_ptr_ut.cpp + non_null_ptr_ut.cpp ref_ut.cpp range_protobuf_repeated_field_ut.cpp + shared_range_ut.cpp type_erasure_ut.cpp + weak_ptr_ut.cpp ) IF (NOT OS_WINDOWS) diff --git a/library/cpp/yt/misc/concepts.h b/library/cpp/yt/misc/concepts.h index aecad4fe60b..eda0bc163f5 100644 --- a/library/cpp/yt/misc/concepts.h +++ b/library/cpp/yt/misc/concepts.h @@ -77,7 +77,7 @@ template <class T> concept CConstRawPtr = CRawPtr<T> && CConst<decltype(*std::declval<T>())>; template <class T> -concept CMutRawPtr = CRawPtr<T> && !CConstRawPtr<T>; +concept CMutableRawPtr = CRawPtr<T> && !CConstRawPtr<T>; //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yt/misc/unittests/ya.make b/library/cpp/yt/misc/unittests/ya.make index a414c5c8e53..c914ca30611 100644 --- a/library/cpp/yt/misc/unittests/ya.make +++ b/library/cpp/yt/misc/unittests/ya.make @@ -8,7 +8,6 @@ SRCS( enum_ut.cpp guid_ut.cpp hash_ut.cpp - non_null_ptr_ut.cpp preprocessor_ut.cpp strong_typedef_ut.cpp tag_invoke_cpo_ut.cpp diff --git a/library/cpp/yt/stockpile/stockpile_linux.cpp b/library/cpp/yt/stockpile/stockpile_linux.cpp index 0fc60b94a8b..8ae847dec77 100644 --- a/library/cpp/yt/stockpile/stockpile_linux.cpp +++ b/library/cpp/yt/stockpile/stockpile_linux.cpp @@ -116,14 +116,14 @@ private: i64 adjustedBufferSize, TDuration adjustedPeriod) { - int returnCode = -::madvise(nullptr, adjustedBufferSize, MADV_STOCKPILE); - YT_LOG_DEBUG_IF(returnCode != 0, "System call \"madvise\" failed: %v", strerror(returnCode)); - - switch(returnCode) { - case 0: - Sleep(Options_.Period); - return {Options_.BufferSize, Options_.Period}; + int result = ::madvise(nullptr, adjustedBufferSize, MADV_STOCKPILE); + if (result == 0) { + Sleep(Options_.Period); + return {Options_.BufferSize, Options_.Period}; + } + YT_LOG_DEBUG("System call \"madvise\" failed: %v", strerror(errno)); + switch (errno) { case ENOMEM: if (adjustedBufferSize / 2 >= PageSize_) { // Immediately make an attempt to reclaim half as much. diff --git a/library/cpp/yt/ya_cpp.make.inc b/library/cpp/yt/ya_cpp.make.inc index cfd07909ebe..81c522e0d61 100644 --- a/library/cpp/yt/ya_cpp.make.inc +++ b/library/cpp/yt/ya_cpp.make.inc @@ -3,5 +3,6 @@ IF (NOT MSVC) CXXFLAGS( -Wdeprecated-this-capture + -Wimplicit-fallthrough ) ENDIF() |