void
CacheCntlr::getOwnerStatistics()
{
const unsigned int m_cores = 4;
int used_cache_count = 0;
int owner_count[m_cores] = {0};
int block_total_count = 0;
//printf("%llx\n", reinterpret_cast<unsigned long long>(m_next_cache_cntlr));
//printf("%d\n", Sim()->getConfig()->hasCacheEfficiencyCallbacks());
//use config routine_tracer/type=funcstats enable hasCacheEfficiencyCallbacks function
//if (m_next_cache_cntlr && !m_next_cache_cntlr->m_next_cache_cntlr && Sim()->getConfig()->hasCacheEfficiencyCallbacks())
if (!m_next_cache_cntlr && Sim()->getConfig()->hasCacheEfficiencyCallbacks())
{
for(UInt32 set_index = 0; set_index < m_master->m_cache->getNumSets(); ++set_index)
{
for(UInt32 way = 0; way < m_master->m_cache->getAssociativity(); ++way)
{
++block_total_count;
CacheBlockInfo *block_info = m_master->m_cache->peekBlock(set_index, way);
//if (block_info->isValid() && !block_info->hasOption(CacheBlockInfo::WARMUP))
if (block_info->isValid())
{
//Sim()->getConfig()->getCacheEfficiencyCallbacks().call_notify(true, block_info->getOwner(), block_info->getUsage(), getCacheBlockSize() >> CacheBlockInfo::BitsUsedOffset);
++used_cache_count;
if(block_info->getOwner() < m_cores)
{
++owner_count[block_info->getOwner()];
}
}
}
}
printf("[CZT] used_cache_count: %d \n", used_cache_count);
for(unsigned int i = 0; i < m_cores; i++ ){
printf("[CZT] owner_count %d : %d \n", i, owner_count[i]);
}
printf("[CZT] block_total_count: %d \n", block_total_count);
}
}