mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Add support for matching source locations ignoring case.
This commit is contained in:
parent
acddcbd9bf
commit
a220f38fbd
@ -8502,7 +8502,7 @@ const ZoneEvent* View::FindZoneAtTime( uint64_t thread, int64_t time ) const
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
void View::FindZones()
|
||||
{
|
||||
m_findZone.match = m_worker.GetMatchingSourceLocation( m_findZone.pattern );
|
||||
m_findZone.match = m_worker.GetMatchingSourceLocation( m_findZone.pattern, m_findZone.ignoreCase );
|
||||
if( m_findZone.match.empty() ) return;
|
||||
|
||||
auto it = m_findZone.match.begin();
|
||||
@ -8521,7 +8521,7 @@ void View::FindZones()
|
||||
|
||||
void View::FindZonesCompare()
|
||||
{
|
||||
m_compare.match[0] = m_worker.GetMatchingSourceLocation( m_compare.pattern );
|
||||
m_compare.match[0] = m_worker.GetMatchingSourceLocation( m_compare.pattern, false );
|
||||
if( !m_compare.match[0].empty() )
|
||||
{
|
||||
auto it = m_compare.match[0].begin();
|
||||
@ -8538,7 +8538,7 @@ void View::FindZonesCompare()
|
||||
}
|
||||
}
|
||||
|
||||
m_compare.match[1] = m_compare.second->GetMatchingSourceLocation( m_compare.pattern );
|
||||
m_compare.match[1] = m_compare.second->GetMatchingSourceLocation( m_compare.pattern, false );
|
||||
if( !m_compare.match[1].empty() )
|
||||
{
|
||||
auto it = m_compare.match[1].begin();
|
||||
|
@ -1241,7 +1241,7 @@ static bool strstr_nocase( const char* l, const char* r )
|
||||
return strstr( ll, rl ) != nullptr;
|
||||
}
|
||||
|
||||
std::vector<int32_t> Worker::GetMatchingSourceLocation( const char* query ) const
|
||||
std::vector<int32_t> Worker::GetMatchingSourceLocation( const char* query, bool ignoreCase ) const
|
||||
{
|
||||
std::vector<int32_t> match;
|
||||
|
||||
@ -1252,7 +1252,16 @@ std::vector<int32_t> Worker::GetMatchingSourceLocation( const char* query ) cons
|
||||
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 )
|
||||
bool found = false;
|
||||
if( ignoreCase )
|
||||
{
|
||||
found = strstr_nocase( str, query );
|
||||
}
|
||||
else
|
||||
{
|
||||
found = strstr( str, query ) != nullptr;
|
||||
}
|
||||
if( found )
|
||||
{
|
||||
match.push_back( (int32_t)i );
|
||||
}
|
||||
@ -1261,7 +1270,16 @@ std::vector<int32_t> Worker::GetMatchingSourceLocation( const char* query ) cons
|
||||
for( auto& srcloc : m_data.sourceLocationPayload )
|
||||
{
|
||||
const auto str = GetString( srcloc->name.active ? srcloc->name : srcloc->function );
|
||||
if( strstr( str, query ) != nullptr )
|
||||
bool found = false;
|
||||
if( ignoreCase )
|
||||
{
|
||||
found = strstr_nocase( str, query );
|
||||
}
|
||||
else
|
||||
{
|
||||
found = strstr( str, query ) != nullptr;
|
||||
}
|
||||
if( found )
|
||||
{
|
||||
auto it = m_data.sourceLocationPayloadMap.find( srcloc );
|
||||
assert( it != m_data.sourceLocationPayloadMap.end() );
|
||||
|
@ -238,7 +238,7 @@ public:
|
||||
tracy_force_inline const Vector<ZoneEvent*>& GetZoneChildren( int32_t idx ) const { return m_data.m_zoneChildren[idx]; }
|
||||
tracy_force_inline const Vector<GpuEvent*>& GetGpuChildren( int32_t idx ) const { return m_data.m_gpuChildren[idx]; }
|
||||
|
||||
std::vector<int32_t> GetMatchingSourceLocation( const char* query ) const;
|
||||
std::vector<int32_t> GetMatchingSourceLocation( const char* query, bool ignoreCase ) const;
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
const SourceLocationZones& GetZonesForSourceLocation( int32_t srcloc ) const;
|
||||
|
Loading…
Reference in New Issue
Block a user