Compare commits

...

3 Commits

Author SHA1 Message Date
Bartosz Taudul ef2a25319c
Update NEWS. 2021-07-11 19:46:02 +02:00
Bartosz Taudul edae542a48
Allow selecting image name for filtering from a list. 2021-07-11 19:43:51 +02:00
Bartosz Taudul b6db644ac6
Add hasher and comparator for StringIdx. 2021-07-11 19:43:40 +02:00
3 changed files with 50 additions and 0 deletions

2
NEWS
View File

@ -37,6 +37,8 @@ v0.x.x (xxxx-xx-xx)
- Cache miss rate.
- Instruction cost estimation method is no longer tied to software call
stack sampling.
- The image name filter entry field is now providing a list of available
images.
v0.7.8 (2021-05-19)

View File

@ -95,6 +95,22 @@ private:
uint8_t m_idx[3];
};
struct StringIdxHasher
{
size_t operator()( const StringIdx& key ) const
{
return charutil::hash( (const char*)&key, sizeof( StringIdx ) );
}
};
struct StringIdxComparator
{
bool operator()( const StringIdx& lhs, const StringIdx& rhs ) const
{
return memcmp( &lhs, &rhs, sizeof( StringIdx ) ) == 0;
}
};
class Int24
{
public:

View File

@ -12580,6 +12580,38 @@ void View::DrawStatistics()
ImGui::SameLine();
m_statisticsImageFilter.Draw( ICON_FA_FILTER "###imageFilter", 200 );
ImGui::SameLine();
if( ImGui::BeginCombo( "###imageCombo", nullptr, ImGuiComboFlags_NoPreview | ImGuiComboFlags_HeightLarge ) )
{
unordered_flat_set<StringIdx, StringIdxHasher, StringIdxComparator> set;
std::vector<const char*> imgNames;
for( auto& v : m_worker.GetSymbolMap() )
{
auto it = set.find( v.second.imageName );
if( it == set.end() )
{
set.emplace( v.second.imageName );
}
}
imgNames.reserve( set.size() );
for( auto& img : set )
{
imgNames.emplace_back( m_worker.GetString( img ) );
}
std::sort( imgNames.begin(), imgNames.end(), [] ( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
for( auto& img : imgNames )
{
bool sel = false;
if( ImGui::Selectable( img, &sel ) )
{
auto len = std::min<size_t>( 255, strlen( img ) );
memcpy( m_statisticsImageFilter.InputBuf, img, len );
m_statisticsImageFilter.InputBuf[len] = 0;
m_statisticsImageFilter.Build();
}
}
ImGui::EndCombo();
}
ImGui::SameLine();
if( ImGui::Button( ICON_FA_BACKSPACE " Clear###image" ) )
{
m_statisticsImageFilter.Clear();