mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Allow skipping functions on top of call stack.
Note that this is on-client performance intensive and shouldn't be used, except in special situations, like processing crashes.
This commit is contained in:
parent
b371003336
commit
d1adf9e8d6
@ -1526,6 +1526,43 @@ void Profiler::CalibrateDelay()
|
||||
}
|
||||
}
|
||||
|
||||
void Profiler::SendCallstack( int depth, uint64_t thread, const char* skipBefore )
|
||||
{
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
auto ptr = Callstack( depth );
|
||||
auto data = (uintptr_t*)ptr;
|
||||
const auto sz = *data++;
|
||||
int i;
|
||||
for( i=0; i<sz; i++ )
|
||||
{
|
||||
auto frame = DecodeCallstackPtr( uint64_t( data[i] ) );
|
||||
const bool found = strcmp( frame.name, skipBefore ) == 0;
|
||||
tracy_free( (void*)frame.name );
|
||||
tracy_free( (void*)frame.file );
|
||||
if( found )
|
||||
{
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( i != sz )
|
||||
{
|
||||
memmove( data, data + i, ( sz - i ) * sizeof( uintptr_t* ) );
|
||||
*--data = sz - i;
|
||||
}
|
||||
|
||||
Magic magic;
|
||||
auto& token = s_token.ptr;
|
||||
auto& tail = token->get_tail_index();
|
||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||
MemWrite( &item->hdr.type, QueueType::Callstack );
|
||||
MemWrite( &item->callstack.ptr, ptr );
|
||||
MemWrite( &item->callstack.thread, thread );
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -325,6 +325,8 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void SendCallstack( int depth, uint64_t thread, const char* skipBefore );
|
||||
|
||||
static bool ShouldExit();
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
|
Loading…
Reference in New Issue
Block a user