Implement asm ip stats counter.

This commit is contained in:
Bartosz Taudul 2020-08-11 20:58:22 +02:00
parent 7aa8e408df
commit 46163a1989
2 changed files with 26 additions and 0 deletions

View File

@ -3156,6 +3156,31 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i
}
}
uint32_t SourceView::CountAsmIpStats( uint64_t addr, const Worker& worker, bool limitView, const View& view )
{
if( limitView )
{
auto vec = worker.GetSamplesForSymbol( addr );
if( !vec ) return 0;
auto it = std::lower_bound( vec->begin(), vec->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
if( it == vec->end() ) return 0;
auto end = std::lower_bound( it, vec->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
return end - it;
}
else
{
uint32_t cnt = 0;
auto ipmap = worker.GetSymbolInstructionPointers( addr );
if( !ipmap ) return 0;
for( auto& ip : *ipmap )
{
auto addr = worker.GetCanonicalPointer( ip.first );
cnt += ip.second;
}
return cnt;
}
}
namespace {
static unordered_flat_set<const char*, charutil::Hasher, charutil::Comparator> GetKeywords()
{

View File

@ -159,6 +159,7 @@ private:
void SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker& worker );
void GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& iptotalAsm, unordered_flat_map<uint64_t, uint32_t>& ipcountSrc, unordered_flat_map<uint64_t, uint32_t>& ipcountAsm, uint32_t& ipmaxSrc, uint32_t& ipmaxAsm, const Worker& worker, bool limitView, const View& view );
uint32_t CountAsmIpStats( uint64_t addr, const Worker& worker, bool limitView, const View& view );
void SelectMicroArchitecture( const char* moniker );