void OfflineX86Code::printEventStats(TCA address, uint32_t instrLen, const PerfEventsMap<TCA>& perfEvents) { static const PerfEventType AnnotatedEvents[] = { EVENT_CYCLES, EVENT_BRANCH_MISSES, EVENT_ICACHE_MISSES, EVENT_DCACHE_MISSES, EVENT_LLC_MISSES, EVENT_ITLB_MISSES, EVENT_DTLB_MISSES, }; const size_t NumAnnotatedEvents = sizeof(AnnotatedEvents) / sizeof(AnnotatedEvents[0]); static const char* SmallCaptions[] = {"cy", "bm", "ic", "dc", "lc", "it", "dt"}; assert(sizeof(SmallCaptions)/sizeof(SmallCaptions[0]) == NumAnnotatedEvents); for (size_t i = 0; i < NumAnnotatedEvents; i++) { uint64_t eventCount = perfEvents.getEventCount(address, address + instrLen - 1, AnnotatedEvents[i]); std::string eventStr; if (eventCount) { eventStr = folly::format("{:>3}:{:>4}", SmallCaptions[i], eventCount).str(); } std::cout << folly::format("{:<10} ", eventStr); } }
bool operator()(TransID t1, TransID t2) const { const auto count1 = transPerfEvents.getEventCount(t1, etype); const auto count2 = transPerfEvents.getEventCount(t2, etype); if (sortByDensity) { const auto size1 = TREC(t1)->aLen; const auto size2 = TREC(t2)->aLen; return count1 * size2 > count2 * size1; } return count1 > count2; }
bool operator()(TransID t1, TransID t2) const { return transPerfEvents.getEventCount(t1, etype) > transPerfEvents.getEventCount(t2, etype); }