diff --git a/src/cpucounters.cpp b/src/cpucounters.cpp index 42692cae..9e7158eb 100644 --- a/src/cpucounters.cpp +++ b/src/cpucounters.cpp @@ -5721,6 +5721,16 @@ PCM::ErrorCode PCM::program(const RawPMUConfigs& curPMUConfigs_, const bool sile { programCXLDP(events64); } + else if (strToUncorePMUID(type) != INVALID_PMU_ID) + { + const auto pmu_id = strToUncorePMUID(type); + programUncorePMUs(pmu_id, [&events64, &events, &pmu_id](UncorePMU& pmu) + { + uint64 * eventsIter = (uint64 *)events64; + pmu.initFreeze(UNC_PMON_UNIT_CTL_FRZ_EN); + PCM::program(pmu, eventsIter, eventsIter + (std::min)(events.programmable.size(), (size_t)ServerUncoreCounterState::maxCounters), UNC_PMON_UNIT_CTL_FRZ_EN); + }); + } else { std::cerr << "ERROR: unrecognized PMU type \"" << type << "\" when trying to program PMUs.\n"; diff --git a/src/cpucounters.h b/src/cpucounters.h index 3acd1764..386d380f 100644 --- a/src/cpucounters.h +++ b/src/cpucounters.h @@ -651,6 +651,15 @@ class PCM_API PCM UBOX_PMU_ID, INVALID_PMU_ID }; +private: + std::unordered_map strToUncorePMUID_ { + }; +public: + UncorePMUIDs strToUncorePMUID(const std::string & type) const + { + const auto iter = strToUncorePMUID_.find(type); + return (iter == strToUncorePMUID_.end()) ? INVALID_PMU_ID : (UncorePMUIDs)iter->second; + } private: typedef std::unordered_map UncorePMUMapType; // socket -> die -> pmu map -> pmu ref array diff --git a/src/pcm-raw.cpp b/src/pcm-raw.cpp index 47b9f78c..cf94734f 100644 --- a/src/pcm-raw.cpp +++ b/src/pcm-raw.cpp @@ -1239,6 +1239,8 @@ uint32 numTMAEvents(PCM* m) return (m->isHWTMAL2Supported() ? 8 : 4); } +uint32 pmu_type = PCM::INVALID_PMU_ID; + void printTransposed(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, SystemCounterState& SysBeforeState, SystemCounterState& SysAfterState, @@ -1719,6 +1721,14 @@ void printTransposed(const PCM::RawPMUConfigs& curPMUConfigs, [&]() { printUncoreRows([](const uint32 u, const uint32 i, const ServerUncoreCounterState& before, const ServerUncoreCounterState& after) { return getCXLDPCounter(u, i, before, after); }, ServerUncoreCounterState::maxCXLPorts, "CXLDP"); }); } + else if ((pmu_type = m->strToUncorePMUID(type)) != PCM::INVALID_PMU_ID) + { + choose(outputType, + [&]() { printUncoreRows(nullptr, (uint32) m->getMaxNumOfUncorePMUs(pmu_type), type); }, + [&]() { printUncoreRows(nullptr, (uint32) m->getMaxNumOfUncorePMUs(pmu_type), type); }, + [&]() { printUncoreRows([](const uint32 u, const uint32 i, const ServerUncoreCounterState& before, const ServerUncoreCounterState& after) { return getUncoreCounter(pmu_type, u, i, before, after); }, (uint32)m->getMaxNumOfUncorePMUs(pmu_type), type); + }); + } else { std::cerr << "ERROR: unrecognized PMU type \"" << type << "\"\n"; @@ -2150,6 +2160,24 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, } } } + else if ((pmu_type = m->strToUncorePMUID(type)) != PCM::INVALID_PMU_ID) + { + for (uint32 s = 0; s < m->getNumSockets(); ++s) + { + for (uint32 unit = 0; unit < m->getMaxNumOfUncorePMUs(pmu_type); ++unit) + { + int i = 0; + for (auto& event : events) + { + choose(outputType, + [s, unit, &type]() { cout << "SKT" << s << type << unit << separator; }, + [&event, &i, &type]() { if (event.second.empty()) cout << type << "Event" << i << separator; else cout << event.second << separator; }, + [&]() { cout << getUncoreCounter(pmu_type, unit, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; }); + ++i; + } + } + } + } else { std::cerr << "ERROR: unrecognized PMU type \"" << type << "\"\n";