No need to right-shift PC by 2. It's a map, so this is a false economy.
#endif
}
-inline void processor_t::update_histogram(size_t pc)
+inline void processor_t::update_histogram(reg_t pc)
{
#ifdef RISCV_ENABLE_HISTOGRAM
- size_t idx = pc >> 2;
- pc_histogram[idx]++;
+ pc_histogram[pc]++;
#endif
}
#ifdef RISCV_ENABLE_HISTOGRAM
if (histogram_enabled)
{
- fprintf(stderr, "PC Histogram size:%lu\n", pc_histogram.size());
- for(auto iterator = pc_histogram.begin(); iterator != pc_histogram.end(); ++iterator) {
- fprintf(stderr, "%0lx %lu\n", (iterator->first << 2), iterator->second);
- }
+ fprintf(stderr, "PC Histogram size:%zu\n", pc_histogram.size());
+ for (auto it : pc_histogram)
+ fprintf(stderr, "%0" PRIx64 " %" PRIu64 "\n", it.first, it.second);
}
#endif
void push_privilege_stack();
void pop_privilege_stack();
void yield_load_reservation() { state.load_reservation = (reg_t)-1; }
- void update_histogram(size_t pc);
+ void update_histogram(reg_t pc);
void register_insn(insn_desc_t);
void register_extension(extension_t*);
bool histogram_enabled;
std::vector<insn_desc_t> instructions;
- std::map<size_t,size_t> pc_histogram;
+ std::map<reg_t,uint64_t> pc_histogram;
static const size_t OPCODE_CACHE_SIZE = 8191;
insn_desc_t opcode_cache[OPCODE_CACHE_SIZE];