diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-09 23:39:40 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-09 23:57:14 +0300 |
commit | e601ca03f859335d57ecff2e5aa6af234b6052ed (patch) | |
tree | de519a847e58a1b3993fcbfe05ff44cc946a3e24 /library/cpp/actors/memory_log | |
parent | bbf2b6878af3854815a2c0ecb07a687071787639 (diff) | |
download | ydb-e601ca03f859335d57ecff2e5aa6af234b6052ed.tar.gz |
Y_VERIFY->Y_ABORT_UNLESS at ^l
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/actors/memory_log')
-rw-r--r-- | library/cpp/actors/memory_log/memlog.cpp | 18 | ||||
-rw-r--r-- | library/cpp/actors/memory_log/mmap.cpp | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/library/cpp/actors/memory_log/memlog.cpp b/library/cpp/actors/memory_log/memlog.cpp index 17a52847d7..263c5c5079 100644 --- a/library/cpp/actors/memory_log/memlog.cpp +++ b/library/cpp/actors/memory_log/memlog.cpp @@ -66,7 +66,7 @@ unsigned TMemoryLog::GetSelfCpu() noexcept { unsigned cpu; if (Y_LIKELY(FastGetCpu != nullptr)) { auto result = FastGetCpu(&cpu, nullptr, nullptr); - Y_VERIFY(result == 0); + Y_ABORT_UNLESS(result == 0); return cpu; } else { return 0; @@ -110,7 +110,7 @@ TMemoryLog::TMemoryLog(size_t totalSize, size_t grainSize) , FreeGrains(DEFAULT_TOTAL_SIZE / DEFAULT_GRAIN_SIZE * 2) , Buf(totalSize) { - Y_VERIFY(DEFAULT_TOTAL_SIZE % DEFAULT_GRAIN_SIZE == 0); + Y_ABORT_UNLESS(DEFAULT_TOTAL_SIZE % DEFAULT_GRAIN_SIZE == 0); NumberOfGrains = DEFAULT_TOTAL_SIZE / DEFAULT_GRAIN_SIZE; for (size_t i = 0; i < NumberOfGrains; ++i) { @@ -118,7 +118,7 @@ TMemoryLog::TMemoryLog(size_t totalSize, size_t grainSize) } NumberOfCpus = NSystemInfo::NumberOfCpus(); - Y_VERIFY(NumberOfGrains > NumberOfCpus); + Y_ABORT_UNLESS(NumberOfGrains > NumberOfCpus); ActiveGrains.Reset(new TGrain*[NumberOfCpus]); for (size_t i = 0; i < NumberOfCpus; ++i) { ActiveGrains[i] = GetGrain(i); @@ -267,7 +267,7 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept { // check for format for snprintf constexpr size_t prologSize = 48; alignas(TMemoryLog::MemcpyAlignment) char prolog[prologSize + 1]; - Y_VERIFY(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog); + Y_ABORT_UNLESS(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog); int snprintfResult = snprintf(prolog, prologSize + 1, "TS %020" PRIu64 " TI %020" PRIu64 " ", GetCycleCountFast(), threadId); @@ -275,7 +275,7 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept { if (snprintfResult < 0) { return false; } - Y_VERIFY(snprintfResult == prologSize); + Y_ABORT_UNLESS(snprintfResult == prologSize); amount += prologSize; if (addLF) { @@ -336,7 +336,7 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { // alignment required by NoCacheMemcpy alignas(TMemoryLog::MemcpyAlignment) char buf[TMemoryLog::MAX_MESSAGE_SIZE]; - Y_VERIFY(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf); + Y_ABORT_UNLESS(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf); int prologSize = snprintf(buf, TMemoryLog::MAX_MESSAGE_SIZE - 2, @@ -347,7 +347,7 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { if (Y_UNLIKELY(prologSize < 0)) { return false; } - Y_VERIFY((ui32)prologSize <= TMemoryLog::MAX_MESSAGE_SIZE); + Y_ABORT_UNLESS((ui32)prologSize <= TMemoryLog::MAX_MESSAGE_SIZE); int add = vsnprintf( &buf[prologSize], @@ -357,11 +357,11 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { if (Y_UNLIKELY(add < 0)) { return false; } - Y_VERIFY(add >= 0); + Y_ABORT_UNLESS(add >= 0); auto totalSize = prologSize + add; buf[totalSize++] = '\n'; - Y_VERIFY((ui32)totalSize <= TMemoryLog::MAX_MESSAGE_SIZE); + Y_ABORT_UNLESS((ui32)totalSize <= TMemoryLog::MAX_MESSAGE_SIZE); return BareMemLogWrite(buf, totalSize) != nullptr; } diff --git a/library/cpp/actors/memory_log/mmap.cpp b/library/cpp/actors/memory_log/mmap.cpp index 201998d343..1fe734235e 100644 --- a/library/cpp/actors/memory_log/mmap.cpp +++ b/library/cpp/actors/memory_log/mmap.cpp @@ -9,7 +9,7 @@ #endif void TMemoryLog::TMMapArea::MMap(size_t amount) { - Y_VERIFY(amount > 0); + Y_ABORT_UNLESS(amount > 0); #if defined(_unix_) constexpr int mmapProt = PROT_READ | PROT_WRITE; @@ -46,14 +46,14 @@ void TMemoryLog::TMMapArea::MUnmap() { #if defined(_unix_) int result = ::munmap(BufPtr, Size); - Y_VERIFY(result == 0); + Y_ABORT_UNLESS(result == 0); #elif defined(_win_) BOOL result = ::UnmapViewOfFile(BufPtr); - Y_VERIFY(result != 0); + Y_ABORT_UNLESS(result != 0); result = ::CloseHandle(Mapping); - Y_VERIFY(result != 0); + Y_ABORT_UNLESS(result != 0); Mapping = 0; #endif |