mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +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
|
#ifndef TRACY_NO_STATISTICS
|
||||||
void View::FindZones()
|
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;
|
if( m_findZone.match.empty() ) return;
|
||||||
|
|
||||||
auto it = m_findZone.match.begin();
|
auto it = m_findZone.match.begin();
|
||||||
@ -8521,7 +8521,7 @@ void View::FindZones()
|
|||||||
|
|
||||||
void View::FindZonesCompare()
|
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() )
|
if( !m_compare.match[0].empty() )
|
||||||
{
|
{
|
||||||
auto it = m_compare.match[0].begin();
|
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() )
|
if( !m_compare.match[1].empty() )
|
||||||
{
|
{
|
||||||
auto it = m_compare.match[1].begin();
|
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;
|
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;
|
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() );
|
assert( it != m_data.sourceLocation.end() );
|
||||||
const auto& srcloc = it->second;
|
const auto& srcloc = it->second;
|
||||||
const auto str = GetString( srcloc.name.active ? srcloc.name : srcloc.function );
|
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 );
|
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 )
|
for( auto& srcloc : m_data.sourceLocationPayload )
|
||||||
{
|
{
|
||||||
const auto str = GetString( srcloc->name.active ? srcloc->name : srcloc->function );
|
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 );
|
auto it = m_data.sourceLocationPayloadMap.find( srcloc );
|
||||||
assert( it != m_data.sourceLocationPayloadMap.end() );
|
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<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]; }
|
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
|
#ifndef TRACY_NO_STATISTICS
|
||||||
const SourceLocationZones& GetZonesForSourceLocation( int32_t srcloc ) const;
|
const SourceLocationZones& GetZonesForSourceLocation( int32_t srcloc ) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user