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

Remove common return value types from function names.

Which types are included is a balance between efficiency and frequency of
occurrence.
This commit is contained in:
Bartosz Taudul 2022-08-15 15:38:34 +02:00
parent fb6f63f06f
commit af934f1387
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -826,6 +826,14 @@ const char* View::GetFrameSetName( const FrameData& fd, const Worker& worker )
}
}
// Short list based on GetTypes() in TracySourceTokenizer.cpp
constexpr const char* TypesList[] = {
"bool ", "char ", "double ", "float ", "int ", "long ", "short ",
"signed ", "unsigned ", "void ", "wchar_t ", "size_t ", "int8_t ",
"int16_t ", "int32_t ", "int64_t ", "intptr_t ", "uint8_t ", "uint16_t ",
"uint32_t ", "uint64_t ", "ptrdiff_t ", nullptr
};
const char* View::ShortenZoneName( const char* name, ImVec2& tsz, float zsz ) const
{
assert( m_shortenName != ShortenName::Never );
@ -890,8 +898,34 @@ const char* View::ShortenZoneName( const char* name, ImVec2& tsz, float zsz ) co
end -= 6;
}
tsz = ImGui::CalcTextSize( buf, end );
return buf;
ptr = buf;
for(;;)
{
auto match = TypesList;
while( *match )
{
auto m = *match;
auto p = ptr;
while( *m )
{
if( *m != *p ) break;
m++;
p++;
}
if( !*m )
{
ptr = p;
break;
}
match++;
}
if( !*match ) break;
}
tsz = ImGui::CalcTextSize( ptr, end );
if( tsz.x < zsz ) return ptr;
return ptr;
}
const char* View::GetThreadContextData( uint64_t thread, bool& _local, bool& _untracked, const char*& program )