Skip to content

Commit fd2bfd5

Browse files
committed
convert to DBG output where needed
1 parent 059c469 commit fd2bfd5

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

src/pcm-raw.cpp

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
461461
cerr << "ERROR: PMU Event map can not be initialized\n";
462462
return AddEventStatus::Failed;
463463
}
464-
// cerr << "Parsing event " << fullEventStr << "\n";
465-
// cerr << "size: " << fullEventStr.size() << "\n";
464+
DBG(2, "Parsing event " , fullEventStr);
465+
DBG(2, "size: " , fullEventStr.size());
466466
while (fullEventStr.empty() == false && fullEventStr.back() == ' ')
467467
{
468468
fullEventStr.resize(fullEventStr.size() - 1); // remove trailing spaces
@@ -482,7 +482,7 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
482482

483483
const auto eventStr = EventTokens[0];
484484

485-
// cerr << "size: " << eventStr.size() << "\n";
485+
DBG(2, "size: " , eventStr.size());
486486
PCM::RawEventConfig config = { {0,0,0,0,0}, "" };
487487
std::string pmuName;
488488

@@ -636,17 +636,17 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
636636
{
637637
std::string unit = EventMap::getField(eventStr, "Unit");
638638
lowerCase(unit);
639-
// std::cout << eventStr << " is uncore event for unit " << unit << "\n";
639+
DBG(2, eventStr , " is uncore event for unit " , unit);
640640
pmuName = (pmuNameMap.find(unit) == pmuNameMap.end()) ? unit : pmuNameMap[unit];
641641
}
642642

643643
config.second = fullEventStr;
644644

645645
if (1)
646646
{
647-
// cerr << "pmuName: " << pmuName << " full event "<< fullEventStr << " \n";
647+
DBG(2, "pmuName: " , pmuName , " full event ", fullEventStr);
648648
std::string CounterStr = EventMap::getField(eventStr, "Counter");
649-
// cout << "Counter: " << CounterStr << "\n";
649+
DBG(2, "Counter: " , CounterStr);
650650
int fixedCounter = -1;
651651
fixed = (pcm_sscanf(CounterStr) >> s_expect("Fixed counter ") >> fixedCounter) ? true : false;
652652
if (!fixed){
@@ -720,15 +720,15 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
720720
};
721721
for (const auto & registerKeyValue : PMUDeclObj)
722722
{
723-
// cout << "Setting " << registerKeyValue.key << " : " << registerKeyValue.value << "\n";
723+
DBG(2, "Setting " , registerKeyValue.key , " : " , registerKeyValue.value);
724724
simdjson::dom::object fieldDescriptionObj = registerKeyValue.value;
725-
// cout << " config: " << uint64_t(fieldDescriptionObj["Config"]) << "\n";
726-
// cout << " Position: " << uint64_t(fieldDescriptionObj["Position"]) << "\n";
725+
DBG(2, " config: " , uint64_t(fieldDescriptionObj["Config"]));
726+
DBG(2, " Position: " , uint64_t(fieldDescriptionObj["Position"]));
727727
const std::string fieldNameStr{ registerKeyValue.key.begin(), registerKeyValue.key.end() };
728728
if (fieldNameStr == "MSRIndex")
729729
{
730730
string fieldValueStr = EventMap::getField(eventStr, fieldNameStr);
731-
// cout << "MSR field " << fieldNameStr << " value is " << fieldValueStr << " (" << read_number(fieldValueStr.c_str()) << ") offcore=" << offcore << "\n";
731+
DBG(2, "MSR field " , fieldNameStr , " value is " , fieldValueStr , " (" , read_number(fieldValueStr.c_str()) , ") offcore=" , offcore);;
732732
lowerCase(fieldValueStr);
733733
if (fieldValueStr == "0" || fieldValueStr == "0x00")
734734
{
@@ -745,7 +745,7 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
745745
}
746746
MSRIndexStr = MSRIndexes[offcoreEventIndex];
747747
}
748-
// cout << " MSR field " << fieldNameStr << " value is " << MSRIndexStr << " (" << read_number(MSRIndexStr.c_str()) << ") offcore=" << offcore << "\n";
748+
DBG(2, " MSR field " , fieldNameStr , " value is " , MSRIndexStr , " (" , read_number(MSRIndexStr.c_str()) , ") offcore=" , offcore);
749749
MSRObject = registerKeyValue.value[MSRIndexStr];
750750
const string msrValueStr = EventMap::getField(eventStr, "MSRValue");
751751
setMSRValue(msrValueStr);
@@ -758,7 +758,7 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
758758
}
759759
if (!EventMap::isField(eventStr, fieldNameStr))
760760
{
761-
// cerr << fieldNameStr << " not found\n";
761+
DBG(2, fieldNameStr , " not found");
762762
if (fieldDescriptionObj["DefaultValue"].error() == NO_SUCH_FIELD)
763763
{
764764
cerr << "ERROR: DefaultValue not provided for field \"" << fieldNameStr << "\" in " << path << "\n";
@@ -786,7 +786,7 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
786786
}
787787
fieldValueStr = offcoreCodes[offcoreEventIndex];
788788
}
789-
// cout << " field " << fieldNameStr << " value is " << fieldValueStr << " (" << read_number(fieldValueStr.c_str()) << ") offcore=" << offcore << "\n";
789+
DBG(2, " field " , fieldNameStr , " value is " , fieldValueStr , " (" , read_number(fieldValueStr.c_str()) , ") offcore=" , offcore);
790790
setConfig(config, fieldDescriptionObj, read_number(fieldValueStr.c_str()), position);
791791
}
792792
}
@@ -934,13 +934,6 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
934934
}
935935
}
936936

937-
/*
938-
for (const auto& keyValue : eventObj)
939-
{
940-
cout << keyValue.key << " : " << keyValue.value << "\n";
941-
}
942-
*/
943-
944937
printEvent(pmuName, fixed, config);
945938

946939
return AddEventStatus::OK;
@@ -2749,9 +2742,6 @@ int mainThrows(int argc, char * argv[])
27492742
}
27502743
m->globalUnfreezeUncoreCounters();
27512744

2752-
//cout << "Time elapsed: " << dec << fixed << AfterTime - BeforeTime << " ms\n";
2753-
//cout << "Called sleep function for " << dec << fixed << delay_ms << " ms\n";
2754-
27552745
printAll(group, m, SysBeforeState, SysAfterState, BeforeState, AfterState, BeforeUncoreState, AfterUncoreState, BeforeSocketState, AfterSocketState, PMUConfigs, groupNr == nGroups);
27562746
if (nGroups == 1)
27572747
{

0 commit comments

Comments
 (0)