mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Common storage for plot names.
This commit is contained in:
parent
5ec3ccd595
commit
96ce90c6ed
@ -541,7 +541,7 @@ void View::DispatchProcess( const QueueItem& ev, char*& ptr )
|
|||||||
AddThreadString( ev.stringTransfer.ptr, ptr, sz );
|
AddThreadString( ev.stringTransfer.ptr, ptr, sz );
|
||||||
break;
|
break;
|
||||||
case QueueType::PlotName:
|
case QueueType::PlotName:
|
||||||
HandlePlotName( ev.stringTransfer.ptr, std::string( ptr, ptr+sz ) );
|
HandlePlotName( ev.stringTransfer.ptr, ptr, sz );
|
||||||
break;
|
break;
|
||||||
case QueueType::MessageData:
|
case QueueType::MessageData:
|
||||||
AddMessageData( ev.stringTransfer.ptr, ptr, sz );
|
AddMessageData( ev.stringTransfer.ptr, ptr, sz );
|
||||||
@ -1209,20 +1209,22 @@ void View::InsertPlot( PlotData* plot, PlotItem* item )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::HandlePlotName( uint64_t name, std::string&& str )
|
void View::HandlePlotName( uint64_t name, char* str, size_t sz )
|
||||||
{
|
{
|
||||||
auto pit = m_pendingPlots.find( name );
|
auto pit = m_pendingPlots.find( name );
|
||||||
assert( pit != m_pendingPlots.end() );
|
assert( pit != m_pendingPlots.end() );
|
||||||
|
|
||||||
auto it = m_plotRev.find( str );
|
const auto sl = StoreString( str, sz );
|
||||||
|
|
||||||
|
auto it = m_plotRev.find( sl.ptr );
|
||||||
if( it == m_plotRev.end() )
|
if( it == m_plotRev.end() )
|
||||||
{
|
{
|
||||||
const auto idx = m_plots.size();
|
const auto idx = m_plots.size();
|
||||||
m_plotMap.emplace( name, idx );
|
m_plotMap.emplace( name, idx );
|
||||||
m_plotRev.emplace( str, idx );
|
m_plotRev.emplace( sl.ptr, idx );
|
||||||
std::lock_guard<std::mutex> lock( m_lock );
|
std::lock_guard<std::mutex> lock( m_lock );
|
||||||
m_plots.push_back( pit->second );
|
m_plots.push_back( pit->second );
|
||||||
//m_strings.emplace( name, std::move( str ) );
|
m_strings.emplace( name, sl.ptr );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@ private:
|
|||||||
|
|
||||||
void InsertPlot( PlotData* plot, int64_t time, double val );
|
void InsertPlot( PlotData* plot, int64_t time, double val );
|
||||||
void InsertPlot( PlotData* plot, PlotItem* item );
|
void InsertPlot( PlotData* plot, PlotItem* item );
|
||||||
void HandlePlotName( uint64_t name, std::string&& str );
|
void HandlePlotName( uint64_t name, char* str, size_t sz );
|
||||||
void HandlePostponedPlots();
|
void HandlePostponedPlots();
|
||||||
|
|
||||||
int64_t GetFrameTime( size_t idx ) const;
|
int64_t GetFrameTime( size_t idx ) const;
|
||||||
@ -259,7 +259,7 @@ private:
|
|||||||
std::unordered_map<uint64_t, ZoneEvent*> m_pendingCustomStrings;
|
std::unordered_map<uint64_t, ZoneEvent*> m_pendingCustomStrings;
|
||||||
std::unordered_map<uint64_t, uint32_t> m_threadMap;
|
std::unordered_map<uint64_t, uint32_t> m_threadMap;
|
||||||
std::unordered_map<uint64_t, uint32_t> m_plotMap;
|
std::unordered_map<uint64_t, uint32_t> m_plotMap;
|
||||||
std::unordered_map<std::string, uint32_t> m_plotRev;
|
std::unordered_map<const char*, uint32_t, charutil::Hasher, charutil::Comparator> m_plotRev;
|
||||||
std::unordered_map<uint64_t, PlotData*> m_pendingPlots;
|
std::unordered_map<uint64_t, PlotData*> m_pendingPlots;
|
||||||
std::unordered_map<uint64_t, MessagePending> m_pendingMessages;
|
std::unordered_map<uint64_t, MessagePending> m_pendingMessages;
|
||||||
std::unordered_map<uint64_t, uint32_t> m_sourceLocationShrink;
|
std::unordered_map<uint64_t, uint32_t> m_sourceLocationShrink;
|
||||||
|
Loading…
Reference in New Issue
Block a user