diff --git a/src/MacMSRDriver/PcmMsr/PcmMsr.cpp b/src/MacMSRDriver/PcmMsr/PcmMsr.cpp index 3f51b740..2e9b3154 100644 --- a/src/MacMSRDriver/PcmMsr/PcmMsr.cpp +++ b/src/MacMSRDriver/PcmMsr/PcmMsr.cpp @@ -194,7 +194,7 @@ IOReturn PcmMsrDriverClassName::buildTopology(TopologyEntry* odata, uint32_t inp odata[i].thread_id = topologies[i].thread_id; odata[i].core_id = topologies[i].core_id; odata[i].tile_id = topologies[i].tile_id; - odata[i].socket = topologies[i].socket; + odata[i].socket_id = topologies[i].socket_id; } IOFreeAligned(topologies, topologyBufferSize); diff --git a/src/cpucounters.cpp b/src/cpucounters.cpp index 31386bd4..8c8e0b2f 100644 --- a/src/cpucounters.cpp +++ b/src/cpucounters.cpp @@ -652,14 +652,14 @@ void PCM::initRDT() MSR[core]->read(IA32_PQR_ASSOC, &msr_pqr_assoc); //std::cout << "initRMID reading IA32_PQR_ASSOC 0x" << std::hex << msr_pqr_assoc << std::dec << "\n"; - //std::cout << "Socket Id : " << topology[core].socket; + //std::cout << "Socket Id : " << topology[core].socket_id; msr_pqr_assoc &= 0xffffffff00000000ULL; - msr_pqr_assoc |= (uint64)(rmid[topology[core].socket] & ((1ULL<<10)-1ULL)); + msr_pqr_assoc |= (uint64)(rmid[topology[core].socket_id] & ((1ULL<<10)-1ULL)); //std::cout << "initRMID writing IA32_PQR_ASSOC 0x" << std::hex << msr_pqr_assoc << std::dec << "\n"; //Write 0xC8F MSR with new RMID for each core MSR[core]->write(IA32_PQR_ASSOC,msr_pqr_assoc); - msr_qm_evtsel = static_cast(rmid[topology[core].socket] & ((1ULL<<10)-1ULL)); + msr_qm_evtsel = static_cast(rmid[topology[core].socket_id] & ((1ULL<<10)-1ULL)); msr_qm_evtsel <<= 32; //Write 0xC8D MSR with new RMID for each core //std::cout << "initRMID writing IA32_QM_EVTSEL 0x" << std::hex << msr_qm_evtsel << std::dec << "\n"; @@ -675,7 +675,7 @@ void PCM::initRDT() memory_bw_total.push_back(std::make_shared(new CounterWidthExtender::MBTCounter(MSR[core]), 24, 1000)); } } - rmid[topology[core].socket] --; + rmid[topology[core].socket_id] --; //std::cout << std::flush; // Explicitly flush after each iteration } /* Get The scaling factor by running CPUID.0xF.0x1 instruction */ @@ -1188,7 +1188,7 @@ bool PCM::discoverSystemTopology() } entry.die_id = getID(apic_id, TopologyEntry::DomainTypeID::DieDomain); entry.die_grp_id = getID(apic_id, TopologyEntry::DomainTypeID::DieGrpDomain); - entry.socket = getID(apic_id, TopologyEntry::DomainTypeID::SocketPackageDomain); + entry.socket_id = getID(apic_id, TopologyEntry::DomainTypeID::SocketPackageDomain); } else { @@ -1281,7 +1281,7 @@ bool PCM::discoverSystemTopology() } topology.push_back(entry); - socketIdMap[entry.socket] = 0; + socketIdMap[entry.socket_id] = 0; } deleteAndNullifyArray(base_slpi); @@ -1329,7 +1329,7 @@ bool PCM::discoverSystemTopology() } topology[entry.os_id] = entry; - socketIdMap[entry.socket] = 0; + socketIdMap[entry.socket_id] = 0; ++num_online_cores; } catch (std::exception &) @@ -1368,10 +1368,10 @@ bool PCM::discoverSystemTopology() return false; } - if (entry.socket == 0 && entry.core_id == 0) ++threads_per_core; + if (entry.socket_id == 0 && entry.core_id == 0) ++threads_per_core; topology.push_back(entry); - socketIdMap[entry.socket] = 0; + socketIdMap[entry.socket_id] = 0; } #else // Getting processor info for Mac OS @@ -1419,10 +1419,10 @@ bool PCM::discoverSystemTopology() return false; } for(int i = 0; i < num_cores; i++){ - socketIdMap[entries[i].socket] = 0; + socketIdMap[entries[i].socket_id] = 0; if(entries[i].os_id >= 0) { - if(entries[i].core_id == 0 && entries[i].socket == 0) ++threads_per_core; + if(entries[i].core_id == 0 && entries[i].socket_id == 0) ++threads_per_core; if (populateHybridEntry(entries[i], i) == false) { return false; @@ -1464,7 +1464,7 @@ bool PCM::discoverSystemTopology() for (int i = 0; (i < (int)num_cores) && (!socketIdMap.empty()); ++i) { if(isCoreOnline((int32)i)) - topology[i].socket = socketIdMap[topology[i].socket]; + topology[i].socket_id = socketIdMap[topology[i].socket_id]; } #if 0 @@ -1472,14 +1472,14 @@ bool PCM::discoverSystemTopology() std::cerr << "Topology:\nsocket os_id core_id\n"; for (int i = 0; i < num_cores; ++i) { - std::cerr << topology[i].socket << " " << topology[i].os_id << " " << topology[i].core_id << "\n"; + std::cerr << topology[i].socket_id << " " << topology[i].os_id << " " << topology[i].core_id << "\n"; } #endif if (threads_per_core == 0) { for (int i = 0; i < (int)num_cores; ++i) { - if (topology[i].socket == topology[0].socket && topology[i].core_id == topology[0].core_id) + if (topology[i].socket_id == topology[0].socket_id && topology[i].core_id == topology[0].core_id) ++threads_per_core; } assert(threads_per_core != 0); @@ -1494,7 +1494,7 @@ bool PCM::discoverSystemTopology() { if(isCoreOnline(i)) { - socketRefCore[topology[i].socket] = i; + socketRefCore[topology[i].socket_id] = i; } } @@ -3132,16 +3132,16 @@ void PCM::printDetailedSystemTopology(const int detailLevel) if (detailLevel > 0) std::cerr << std::setw(16) << it->module_id; std::cerr << std::setw(16) << it->tile_id; if (detailLevel > 0) std::cerr << std::setw(16) << it->die_id << std::setw(16) << it->die_grp_id; - std::cerr << std::setw(16) << it->socket + std::cerr << std::setw(16) << it->socket_id << std::setw(16) << it->getCoreTypeStr() << std::setw(16) << it->native_cpu_model << "\n"; - if (std::find(core_id_by_socket[it->socket].begin(), core_id_by_socket[it->socket].end(), it->core_id) - == core_id_by_socket[it->socket].end()) - core_id_by_socket[it->socket].push_back(it->core_id); + if (std::find(core_id_by_socket[it->socket_id].begin(), core_id_by_socket[it->socket_id].end(), it->core_id) + == core_id_by_socket[it->socket_id].end()) + core_id_by_socket[it->socket_id].push_back(it->core_id); // add socket offset to distinguish cores and tiles from different sockets - os_id_by_core[(it->socket << 15) + it->core_id].push_back(it->os_id); - os_id_by_tile[(it->socket << 15) + it->tile_id].push_back(it->os_id); + os_id_by_core[(it->socket_id << 15) + it->core_id].push_back(it->os_id); + os_id_by_tile[(it->socket_id << 15) + it->tile_id].push_back(it->os_id); ++counter; } @@ -3233,7 +3233,7 @@ void PCM::showSpecControlMSRs() bool PCM::isCoreOnline(int32 os_core_id) const { - return (topology[os_core_id].os_id != -1) && (topology[os_core_id].core_id != -1) && (topology[os_core_id].socket != -1); + return (topology[os_core_id].os_id != -1) && (topology[os_core_id].core_id != -1) && (topology[os_core_id].socket_id != -1); } bool PCM::isSocketOnline(int32 socket_id) const @@ -6674,7 +6674,7 @@ void PCM::readQPICounters(SystemCounterState & result) if(core == socketRefCore[0]) MSR[core]->read(W_MSR_PMON_FIXED_CTR, &(result.uncoreTSC)); - uint32 s = topology[core].socket; + uint32 s = topology[core].socket_id; if (!SocketProcessed[s]) { @@ -6802,7 +6802,7 @@ SocketCounterState PCM::getSocketCounterState(uint32 socket) { // reading core and uncore counter states for (int32 core = 0; core < num_cores; ++core) - if (isCoreOnline(core) && (topology[core].socket == int32(socket))) + if (isCoreOnline(core) && (topology[core].socket_id == int32(socket))) result.readAndAggregate(MSR[core]); readAndAggregateUncoreMCCounters(socket, result); @@ -6836,7 +6836,7 @@ void PCM::getAllCounterStates(SystemCounterState & systemState, std::vectorapicId() == te.socket ) { + if ( socket->apicId() == te.socket_id ) { Core* core = nullptr; if ( (core = socket->findCoreByTileID( te.tile_id )) == nullptr ) { // std::cerr << "SystemRoot::addThread: " << te.tile_id << ", " << osID << "\n"; - core = new Core( pcm_, te.core_id, te.tile_id, te.socket ); + core = new Core( pcm_, te.core_id, te.tile_id, te.socket_id ); // std::cerr << "new Core ThreadID: " << te.thread_id << "\n"; core->addHyperThreadInfo( te.thread_id, osID ); socket->addCore( core ); - // std::cerr << "Added core " << te.core_id << " with os_id " << osID << ", threadid " << te.thread_id << " and tileid " << te.tile_id << " to socket " << te.socket << ".\n"; + // std::cerr << "Added core " << te.core_id << " with os_id " << osID << ", threadid " << te.thread_id << " and tileid " << te.tile_id << " to socket " << te.socket_id << ".\n"; } else { // std::cerr << "existing Core ThreadID: " << te.thread_id << "\n"; core->addHyperThreadInfo( te.thread_id, osID ); - // std::cerr << "Augmented core " << te.core_id << " with osID " << osID << " and threadid " << te.thread_id << " for the hyperthread to socket " << te.socket << ".\n"; + // std::cerr << "Augmented core " << te.core_id << " with osID " << osID << " and threadid " << te.thread_id << " for the hyperthread to socket " << te.socket_id << ".\n"; } entryAdded = true; break; diff --git a/src/topologyentry.h b/src/topologyentry.h index 39ffe153..d86f9f9b 100644 --- a/src/topologyentry.h +++ b/src/topologyentry.h @@ -17,7 +17,7 @@ struct PCM_API TopologyEntry // describes a core int32 tile_id; // tile is a constalation of 1 or more cores sharing same L2 cache. Unique for entire system int32 die_id; int32 die_grp_id; - int32 socket; + int32 socket_id; int32 native_cpu_model = -1; enum DomainTypeID { @@ -38,7 +38,7 @@ struct PCM_API TopologyEntry // describes a core }; CoreType core_type = Invalid; - TopologyEntry() : os_id(-1), thread_id (-1), core_id(-1), module_id(-1), tile_id(-1), die_id(-1), die_grp_id(-1), socket(-1) { } + TopologyEntry() : os_id(-1), thread_id (-1), core_id(-1), module_id(-1), tile_id(-1), die_id(-1), die_grp_id(-1), socket_id(-1) { } const char* getCoreTypeStr() { switch (core_type) @@ -73,7 +73,7 @@ inline void fillEntry(TopologyEntry & entry, const uint32 & smtMaskWidth, const { entry.thread_id = smtMaskWidth ? extract_bits_ui(apic_id, 0, smtMaskWidth - 1) : 0; entry.core_id = (smtMaskWidth + coreMaskWidth) ? extract_bits_ui(apic_id, smtMaskWidth, smtMaskWidth + coreMaskWidth - 1) : 0; - entry.socket = extract_bits_ui(apic_id, smtMaskWidth + coreMaskWidth, 31); + entry.socket_id = extract_bits_ui(apic_id, smtMaskWidth + coreMaskWidth, 31); entry.tile_id = extract_bits_ui(apic_id, l2CacheMaskShift, 31); }