mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Add strings to map directly in StringDiscovery.
This commit is contained in:
parent
2f01014a95
commit
0b4c2724ce
@ -19,18 +19,19 @@ public:
|
||||
tracy_force_inline bool IsPending() const { return !m_pending.empty(); }
|
||||
|
||||
// Merge( destination, postponed )
|
||||
tracy_force_inline bool StringDiscovered( uint64_t name, const StringLocation& sl, std::function<void(T,T)> Merge )
|
||||
template<typename U>
|
||||
tracy_force_inline void StringDiscovered( uint64_t name, const StringLocation& sl, U& stringMap, std::function<void(T,T)> Merge )
|
||||
{
|
||||
auto pit = m_pending.find( name );
|
||||
assert( pit != m_pending.end() );
|
||||
|
||||
auto it = m_rev.find( sl.ptr );
|
||||
bool add = it == m_rev.end();
|
||||
if( add )
|
||||
if( it == m_rev.end() )
|
||||
{
|
||||
m_map.emplace( name, pit->second );
|
||||
m_rev.emplace( sl.ptr, pit->second );
|
||||
m_data.push_back( pit->second );
|
||||
stringMap.emplace( name, sl.ptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -40,8 +41,6 @@ public:
|
||||
}
|
||||
|
||||
m_pending.erase( pit );
|
||||
|
||||
return add;
|
||||
}
|
||||
|
||||
tracy_force_inline T Retrieve( uint64_t name, std::function<T(uint64_t)> Create, std::function<void(uint64_t)> Query )
|
||||
|
@ -1613,16 +1613,12 @@ void Worker::InsertPlot( PlotData* plot, int64_t time, double val )
|
||||
void Worker::HandlePlotName( uint64_t name, char* str, size_t sz )
|
||||
{
|
||||
const auto sl = StoreString( str, sz );
|
||||
bool addString = m_data.plots.StringDiscovered( name, sl, [this] ( PlotData* dst, PlotData* src ) {
|
||||
m_data.plots.StringDiscovered( name, sl, m_data.strings, [this] ( PlotData* dst, PlotData* src ) {
|
||||
for( auto& v : src->data )
|
||||
{
|
||||
InsertPlot( dst, v.time, v.val );
|
||||
}
|
||||
} );
|
||||
if( addString )
|
||||
{
|
||||
m_data.strings.emplace( name, sl.ptr );
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::HandlePostponedPlots()
|
||||
|
Loading…
Reference in New Issue
Block a user