Force inline AppendData(), NeedDataSize().

This commit is contained in:
Bartosz Taudul 2020-02-23 14:44:19 +01:00
parent 6968a42abe
commit 96034bca3e
2 changed files with 19 additions and 21 deletions

View File

@ -48,7 +48,6 @@
#include <thread> #include <thread>
#include "../common/TracyAlign.hpp" #include "../common/TracyAlign.hpp"
#include "../common/TracyProtocol.hpp"
#include "../common/TracySocket.hpp" #include "../common/TracySocket.hpp"
#include "../common/TracySystem.hpp" #include "../common/TracySystem.hpp"
#include "../common/tracy_lz4.hpp" #include "../common/tracy_lz4.hpp"
@ -2033,13 +2032,6 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
return DequeueStatus::DataDequeued; return DequeueStatus::DataDequeued;
} }
bool Profiler::AppendData( const void* data, size_t len )
{
const auto ret = NeedDataSize( len );
AppendDataUnsafe( data, len );
return ret;
}
bool Profiler::CommitData() bool Profiler::CommitData()
{ {
bool ret = SendData( m_buffer + m_bufferStart, m_bufferOffset - m_bufferStart ); bool ret = SendData( m_buffer + m_bufferStart, m_bufferOffset - m_bufferStart );
@ -2048,17 +2040,6 @@ bool Profiler::CommitData()
return ret; return ret;
} }
bool Profiler::NeedDataSize( size_t len )
{
assert( len <= TargetFrameSize );
bool ret = true;
if( m_bufferOffset - m_bufferStart + len > TargetFrameSize )
{
ret = CommitData();
}
return ret;
}
bool Profiler::SendData( const char* data, size_t len ) bool Profiler::SendData( const char* data, size_t len )
{ {
const lz4sz_t lz4sz = LZ4_compress_fast_continue( (LZ4_stream_t*)m_stream, data, m_lz4Buf + sizeof( lz4sz_t ), (int)len, LZ4Size, 1 ); const lz4sz_t lz4sz = LZ4_compress_fast_continue( (LZ4_stream_t*)m_stream, data, m_lz4Buf + sizeof( lz4sz_t ), (int)len, LZ4Size, 1 );

View File

@ -14,6 +14,7 @@
#include "../common/TracyAlign.hpp" #include "../common/TracyAlign.hpp"
#include "../common/TracyAlloc.hpp" #include "../common/TracyAlloc.hpp"
#include "../common/TracyMutex.hpp" #include "../common/TracyMutex.hpp"
#include "../common/TracyProtocol.hpp"
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32 || defined __CYGWIN__
# include <intrin.h> # include <intrin.h>
@ -518,9 +519,25 @@ private:
DequeueStatus Dequeue( tracy::moodycamel::ConsumerToken& token ); DequeueStatus Dequeue( tracy::moodycamel::ConsumerToken& token );
DequeueStatus DequeueContextSwitches( tracy::moodycamel::ConsumerToken& token, int64_t& timeStop ); DequeueStatus DequeueContextSwitches( tracy::moodycamel::ConsumerToken& token, int64_t& timeStop );
DequeueStatus DequeueSerial(); DequeueStatus DequeueSerial();
bool AppendData( const void* data, size_t len );
bool CommitData(); bool CommitData();
bool NeedDataSize( size_t len );
tracy_force_inline bool AppendData( const void* data, size_t len )
{
const auto ret = NeedDataSize( len );
AppendDataUnsafe( data, len );
return ret;
}
tracy_force_inline bool NeedDataSize( size_t len )
{
assert( len <= TargetFrameSize );
bool ret = true;
if( m_bufferOffset - m_bufferStart + len > TargetFrameSize )
{
ret = CommitData();
}
return ret;
}
tracy_force_inline void AppendDataUnsafe( const void* data, size_t len ) tracy_force_inline void AppendDataUnsafe( const void* data, size_t len )
{ {