mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Do postponed work only when needed.
This commit is contained in:
parent
9bb1d13afa
commit
c220177828
@ -731,6 +731,7 @@ bool View::DrawImpl()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::lock_guard<std::mutex> lock( m_worker.GetDataLock() );
|
std::lock_guard<std::mutex> lock( m_worker.GetDataLock() );
|
||||||
|
m_worker.DoPostponedWork();
|
||||||
if( !m_worker.IsDataStatic() )
|
if( !m_worker.IsDataStatic() )
|
||||||
{
|
{
|
||||||
if( m_worker.IsConnected() )
|
if( m_worker.IsConnected() )
|
||||||
|
@ -2797,38 +2797,6 @@ void Worker::Exec()
|
|||||||
m_netWriteCv.notify_one();
|
m_netWriteCv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
HandlePostponedPlots();
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
|
||||||
if( m_data.newFramesWereReceived )
|
|
||||||
{
|
|
||||||
HandlePostponedSamples();
|
|
||||||
HandlePostponedGhostZones();
|
|
||||||
m_data.newFramesWereReceived = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if( m_data.newSymbolsIndex >= 0 )
|
|
||||||
{
|
|
||||||
#ifdef NO_PARALLEL_SORT
|
|
||||||
pdqsort_branchless( m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
|
||||||
#else
|
|
||||||
std::sort( std::execution::par_unseq, m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
|
||||||
#endif
|
|
||||||
const auto ms = std::lower_bound( m_data.symbolLoc.begin(), m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc[m_data.newSymbolsIndex], [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
|
||||||
std::inplace_merge( ms, m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
|
||||||
m_data.newSymbolsIndex = -1;
|
|
||||||
}
|
|
||||||
if( m_data.newInlineSymbolsIndex >= 0 )
|
|
||||||
{
|
|
||||||
#ifdef NO_PARALLEL_SORT
|
|
||||||
pdqsort_branchless( m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline.end() );
|
|
||||||
#else
|
|
||||||
std::sort( std::execution::par_unseq, m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline.end() );
|
|
||||||
#endif
|
|
||||||
const auto ms = std::lower_bound( m_data.symbolLocInline.begin(), m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline[m_data.newInlineSymbolsIndex] );
|
|
||||||
std::inplace_merge( ms, m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline.end() );
|
|
||||||
m_data.newInlineSymbolsIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !m_serverQueryQueue.empty() && m_serverQuerySpaceLeft > 0 )
|
if( !m_serverQueryQueue.empty() && m_serverQuerySpaceLeft > 0 )
|
||||||
{
|
{
|
||||||
const auto toSend = std::min( m_serverQuerySpaceLeft, m_serverQueryQueue.size() );
|
const auto toSend = std::min( m_serverQuerySpaceLeft, m_serverQueryQueue.size() );
|
||||||
@ -3953,12 +3921,44 @@ void Worker::HandleFrameName( uint64_t name, const char* str, size_t sz )
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::HandlePostponedPlots()
|
void Worker::DoPostponedWork()
|
||||||
{
|
{
|
||||||
for( auto& plot : m_data.plots.Data() )
|
for( auto& plot : m_data.plots.Data() )
|
||||||
{
|
{
|
||||||
if( !plot->data.is_sorted() ) plot->data.sort();
|
if( !plot->data.is_sorted() ) plot->data.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
if( m_data.newFramesWereReceived )
|
||||||
|
{
|
||||||
|
HandlePostponedSamples();
|
||||||
|
HandlePostponedGhostZones();
|
||||||
|
m_data.newFramesWereReceived = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( m_data.newSymbolsIndex >= 0 )
|
||||||
|
{
|
||||||
|
#ifdef NO_PARALLEL_SORT
|
||||||
|
pdqsort_branchless( m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
||||||
|
#else
|
||||||
|
std::sort( std::execution::par_unseq, m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
||||||
|
#endif
|
||||||
|
const auto ms = std::lower_bound( m_data.symbolLoc.begin(), m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc[m_data.newSymbolsIndex], [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
||||||
|
std::inplace_merge( ms, m_data.symbolLoc.begin() + m_data.newSymbolsIndex, m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } );
|
||||||
|
m_data.newSymbolsIndex = -1;
|
||||||
|
}
|
||||||
|
if( m_data.newInlineSymbolsIndex >= 0 )
|
||||||
|
{
|
||||||
|
#ifdef NO_PARALLEL_SORT
|
||||||
|
pdqsort_branchless( m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline.end() );
|
||||||
|
#else
|
||||||
|
std::sort( std::execution::par_unseq, m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline.end() );
|
||||||
|
#endif
|
||||||
|
const auto ms = std::lower_bound( m_data.symbolLocInline.begin(), m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline[m_data.newInlineSymbolsIndex] );
|
||||||
|
std::inplace_merge( ms, m_data.symbolLocInline.begin() + m_data.newInlineSymbolsIndex, m_data.symbolLocInline.end() );
|
||||||
|
m_data.newInlineSymbolsIndex = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
@ -6817,6 +6817,8 @@ void Worker::Disconnect()
|
|||||||
|
|
||||||
void Worker::Write( FileWrite& f )
|
void Worker::Write( FileWrite& f )
|
||||||
{
|
{
|
||||||
|
DoPostponedWork();
|
||||||
|
|
||||||
f.Write( FileHeader, sizeof( FileHeader ) );
|
f.Write( FileHeader, sizeof( FileHeader ) );
|
||||||
|
|
||||||
f.Write( &m_delay, sizeof( m_delay ) );
|
f.Write( &m_delay, sizeof( m_delay ) );
|
||||||
|
@ -590,6 +590,8 @@ public:
|
|||||||
|
|
||||||
std::pair<uint64_t, uint64_t> GetTextureCompressionBytes() const { return std::make_pair( m_texcomp.GetInputBytesCount(), m_texcomp.GetOutputBytesCount() ); }
|
std::pair<uint64_t, uint64_t> GetTextureCompressionBytes() const { return std::make_pair( m_texcomp.GetInputBytesCount(), m_texcomp.GetOutputBytesCount() ); }
|
||||||
|
|
||||||
|
void DoPostponedWork();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Network();
|
void Network();
|
||||||
void Exec();
|
void Exec();
|
||||||
@ -763,7 +765,6 @@ private:
|
|||||||
void HandlePlotName( uint64_t name, const char* str, size_t sz );
|
void HandlePlotName( uint64_t name, const char* str, size_t sz );
|
||||||
void HandleFrameName( uint64_t name, const char* str, size_t sz );
|
void HandleFrameName( uint64_t name, const char* str, size_t sz );
|
||||||
|
|
||||||
void HandlePostponedPlots();
|
|
||||||
void HandlePostponedSamples();
|
void HandlePostponedSamples();
|
||||||
void HandlePostponedGhostZones();
|
void HandlePostponedGhostZones();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user