@@ -359,7 +359,7 @@ bool PCM::isHWTMAL1Supported() const
359359void PCM::readCPUMicrocodeLevel ()
360360{
361361 if (MSR.empty ()) return ;
362- const int ref_core = 0 ;
362+ const int32 ref_core = socketRefCore[ 0 ] ;
363363 TemporalThreadAffinity affinity (ref_core);
364364 if (affinity.supported () && isCoreOnline (ref_core))
365365 { // see "Update Signature and Verification" and "Determining the Signature"
@@ -1110,7 +1110,22 @@ bool PCM::discoverSystemTopology()
11101110 };
11111111 std::unordered_map<int , domain> topologyDomainMap;
11121112 {
1113- TemporalThreadAffinity aff0 (0 );
1113+ const int32 maxTopoDomainAff = 1 <<16 ;
1114+ int32 topoDomainAff = -1 ;
1115+
1116+ for (int32 core = 0 ; core < maxTopoDomainAff; ++core)
1117+ {
1118+ try {
1119+ TemporalThreadAffinity _ (core);
1120+ topoDomainAff = core;
1121+ }
1122+ catch (...)
1123+ {
1124+ }
1125+ if (topoDomainAff != -1 ) break ;
1126+ }
1127+
1128+ TemporalThreadAffinity _ (topoDomainAff);
11141129
11151130 if (initCoreMasks (smtMaskWidth, coreMaskWidth, l2CacheMaskShift, l3CacheMaskShift) == false )
11161131 {
@@ -4637,7 +4652,7 @@ uint64 RDTSC();
46374652
46384653void PCM::computeNominalFrequency ()
46394654{
4640- const int ref_core = 0 ;
4655+ const int32 ref_core = socketRefCore[ 0 ] ;
46414656 const uint64 before = getInvariantTSC_Fast (ref_core);
46424657 MySleepMs (100 );
46434658 const uint64 after = getInvariantTSC_Fast (ref_core);
@@ -4809,11 +4824,11 @@ void PCM::computeQPISpeedBeckton(int core_nr)
48094824 MSR[core_nr]->read (R_MSR_PMON_CTR0, &startFlits);
48104825
48114826 const uint64 timerGranularity = 1000000ULL ; // mks
4812- uint64 startTSC = getTickCount (timerGranularity, (uint32) core_nr);
4827+ uint64 startTSC = getTickCount (timerGranularity, core_nr);
48134828 uint64 endTSC;
48144829 do
48154830 {
4816- endTSC = getTickCount (timerGranularity, (uint32) core_nr);
4831+ endTSC = getTickCount (timerGranularity, core_nr);
48174832 } while (endTSC - startTSC < 200000ULL ); // spin for 200 ms
48184833
48194834 uint64 endFlits = 0 ;
@@ -5401,8 +5416,9 @@ int convertUnknownToInt(size_t size, char* value)
54015416#endif
54025417
54035418
5404- uint64 PCM::getTickCount (uint64 multiplier, uint32 core)
5419+ uint64 PCM::getTickCount (uint64 multiplier, int32 core)
54055420{
5421+ if (core == -1 ) core = socketRefCore[0 ];
54065422 return (multiplier * getInvariantTSC_Fast (core)) / getNominalFrequency ();
54075423}
54085424
0 commit comments