diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-08-15 16:38:34 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-08-15 16:38:34 +0300 |
commit | af934f1387a12dbd24af56bf18282a4f3eecad93 (patch) | |
tree | 71dc818f12c68135edddbac9e62c1db5a3f1c663 /server/TracyView_Utility.cpp | |
parent | fb6f63f06f48e4e233d5e9762bd8c49189ac096f (diff) |
Remove common return value types from function names.
Which types are included is a balance between efficiency and frequency of
occurrence.
Diffstat (limited to 'server/TracyView_Utility.cpp')
-rw-r--r-- | server/TracyView_Utility.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/server/TracyView_Utility.cpp b/server/TracyView_Utility.cpp index c6731229..f98a12c9 100644 --- a/server/TracyView_Utility.cpp +++ b/server/TracyView_Utility.cpp @@ -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 ) |