Skip to content

Commit 6a2fe06

Browse files
committed
Investivating the issue with 32-bit Android (part 5)
1 parent 9b7619c commit 6a2fe06

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

Sources/Shared/Core/Logger.cpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,6 @@ namespace Death { namespace Trace {
350350
void LoggerBackend::SetBacktraceFlushLevel(TraceLevel flushLevel) noexcept
351351
{
352352
#if defined(DEATH_TRACE_ASYNC)
353-
if (!_backtraceStorage) {
354-
_backtraceStorage = std::make_shared<BacktraceStorage>();
355-
}
356-
357-
_backtraceStorage->SetCapacity(8);
358-
359353
_backtraceFlushLevel.store(flushLevel, std::memory_order_relaxed);
360354
#else
361355
_backtraceFlushLevel = flushLevel;
@@ -941,12 +935,12 @@ namespace Death { namespace Trace {
941935
#if defined(DEATH_TRACE_ASYNC)
942936
using namespace Implementation;
943937

944-
/*while (!EnqueueEntry(InitializeBacktraceRequested, 0, nullptr, nullptr, 0)) {
938+
while (!EnqueueEntry(InitializeBacktraceRequested, 0, reinterpret_cast<const void*>(static_cast<std::uintptr_t>(maxCapacity)), nullptr, 0)) {
945939
std::this_thread::sleep_for(std::chrono::nanoseconds{100});
946-
}*/
940+
}
947941

948942
_backend.SetBacktraceFlushLevel(flushLevel);
949-
//_backend.Notify();
943+
_backend.Notify();
950944
#else
951945
_backend.InitializeBacktrace(maxCapacity);
952946
_backend.SetBacktraceFlushLevel(flushLevel);
@@ -1007,13 +1001,6 @@ namespace Death { namespace Trace {
10071001
return scopedThreadContext.GetThreadContext();
10081002
}
10091003

1010-
std::uint8_t* Logger::PrepareWriteBuffer(std::size_t totalSize) noexcept
1011-
{
1012-
using namespace Implementation;
1013-
1014-
return _threadContext->GetSpscQueue<DefaultQueueType>().prepareWrite(totalSize);
1015-
}
1016-
10171004
bool Logger::EnqueueEntry(TraceLevel level, std::uint64_t timestamp, const void* functionName, const void* content, std::uint32_t contentLength) noexcept
10181005
{
10191006
using namespace Implementation;
@@ -1023,8 +1010,8 @@ namespace Death { namespace Trace {
10231010
}
10241011

10251012
std::size_t totalSize = /*Level*/ sizeof(std::uint8_t) + /*Timestamp*/ sizeof(std::uint64_t) +
1026-
/*FunctionName*/ sizeof(std::uintptr_t) + /*Length*/ sizeof(std::uint32_t) + /*Content*/ contentLength;
1027-
std::uint8_t* writeBuffer = PrepareWriteBuffer(totalSize);
1013+
/*FunctionName*/ sizeof(std::uintptr_t) + /*Length*/ sizeof(std::uint32_t) + /*Content*/ std::size_t(contentLength);
1014+
std::uint8_t* writeBuffer = _threadContext->GetSpscQueue<DefaultQueueType>().prepareWrite(totalSize);
10281015

10291016
if constexpr (DefaultQueueType == QueueType::BoundedDropping ||
10301017
DefaultQueueType == QueueType::UnboundedDropping) {
@@ -1048,7 +1035,7 @@ namespace Death { namespace Trace {
10481035
}
10491036

10501037
// Not enough space to push to queue, keep trying
1051-
writeBuffer = PrepareWriteBuffer(totalSize);
1038+
writeBuffer = _threadContext->GetSpscQueue<DefaultQueueType>().prepareWrite(totalSize);
10521039
} while (writeBuffer == nullptr);
10531040
}
10541041
}

Sources/Shared/Core/Logger.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ namespace Death { namespace Trace {
13201320
void Flush(std::uint32_t sleepDurationNs = 100) noexcept;
13211321

13221322
/** @brief Initializes backtrace storage to be able to use @ref TraceLevel::Deferred */
1323-
void InitializeBacktrace(std::uint32_t maxCapacity, TraceLevel flushLevel = TraceLevel::Unknown);
1323+
DEATH_NEVER_INLINE void InitializeBacktrace(std::uint32_t maxCapacity, TraceLevel flushLevel = TraceLevel::Unknown);
13241324
/** @brief Writes any stored deferred entries to all sinks asynchronously */
13251325
void FlushBacktraceAsync() noexcept;
13261326

@@ -1338,8 +1338,6 @@ namespace Death { namespace Trace {
13381338
static inline DEATH_THREAD_LOCAL ThreadContext* _threadContext = nullptr;
13391339

13401340
static ThreadContext* GetLocalThreadContext() noexcept;
1341-
1342-
std::uint8_t* PrepareWriteBuffer(std::size_t totalSize) noexcept;
13431341
#endif
13441342

13451343
bool EnqueueEntry(TraceLevel level, std::uint64_t timestamp, const void* functionName, const void* content, std::uint32_t contentLength) noexcept;

0 commit comments

Comments
 (0)