1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Implement search for matching source locations.

This commit is contained in:
Bartosz Taudul 2018-03-04 16:52:45 +01:00
parent f8c5f28372
commit b48602f5d1
2 changed files with 33 additions and 0 deletions

View File

@ -372,6 +372,37 @@ const SourceLocation& Worker::GetSourceLocation( int32_t srcloc ) const
}
}
std::vector<int32_t> Worker::GetMatchingSourceLocation( const char* query ) const
{
std::vector<int32_t> match;
const auto sz = m_data.sourceLocationExpand.size();
for( size_t i=0; i<sz; i++ )
{
const auto it = m_data.sourceLocation.find( m_data.sourceLocationExpand[i] );
assert( it != m_data.sourceLocation.end() );
const auto& srcloc = it->second;
const auto str = GetString( srcloc.name.active ? srcloc.name : srcloc.function );
if( strstr( str, query ) != nullptr )
{
match.push_back( (int32_t)i );
}
}
for( auto& srcloc : m_data.sourceLocationPayload )
{
const auto str = GetString( srcloc->name.active ? srcloc->name : srcloc->function );
if( strstr( str, query ) != nullptr )
{
auto it = m_data.sourceLocationPayloadMap.find( srcloc );
assert( it != m_data.sourceLocationPayloadMap.end() );
match.push_back( it->second );
}
}
return match;
}
void Worker::Exec()
{
timeval tv;

View File

@ -101,6 +101,8 @@ public:
const char* GetThreadString( uint64_t id ) const;
const SourceLocation& GetSourceLocation( int32_t srcloc ) const;
std::vector<int32_t> GetMatchingSourceLocation( const char* query ) const;
NonRecursiveBenaphore& GetMbpsDataLock() { return m_mbpsData.lock; }
const std::vector<float>& GetMbpsData() const { return m_mbpsData.mbps; }
float GetCompRatio() const { return m_mbpsData.compRatio; }