StringIdx search from string.

This commit is contained in:
Bartosz Taudul 2020-04-02 02:08:00 +02:00
parent 387fdb30b0
commit e7f4f58886
2 changed files with 15 additions and 0 deletions

View File

@ -2379,6 +2379,20 @@ int64_t Worker::GetZoneEnd( const GpuEvent& ev )
}
}
uint32_t Worker::FindStringIdx( const char* str ) const
{
charutil::StringKey key = { str, strlen( str ) };
auto sit = m_data.stringMap.find( key );
if( sit == m_data.stringMap.end() )
{
return 0;
}
else
{
return sit->second;
}
}
const char* Worker::GetString( uint64_t ptr ) const
{
const auto it = m_data.strings.find( ptr );

View File

@ -455,6 +455,7 @@ public:
static tracy_force_inline int64_t GetZoneEndDirect( const ZoneEvent& ev ) { return ev.IsEndValid() ? ev.End() : ev.Start(); }
static tracy_force_inline int64_t GetZoneEndDirect( const GpuEvent& ev ) { return ev.GpuEnd() >= 0 ? ev.GpuEnd() : ev.GpuStart(); }
uint32_t FindStringIdx( const char* str ) const;
const char* GetString( uint64_t ptr ) const;
const char* GetString( const StringRef& ref ) const;
const char* GetString( const StringIdx& idx ) const;