Skip to content

Commit 1ecb288

Browse files
authored
Merge pull request #353 from opcm/push-2021-12-02
Push 2021 12 02
2 parents 0ec44fb + f32bb0f commit 1ecb288

File tree

7 files changed

+399
-121
lines changed

7 files changed

+399
-121
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ latex/
3131
*.vcxproj.user
3232
.vs/
3333
.idea/
34+
unitTest/urltest

PCM-Service_Win/PCMService.h

100644100755
Lines changed: 187 additions & 52 deletions
Large diffs are not rendered by default.

pcm-raw.cpp

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,12 @@ bool show_partial_core_output = false;
736736
bitset<MAX_CORES> ycores;
737737
bool flushLine = false;
738738
bool transpose = false;
739-
std::string sep = ",";
739+
std::string separator = ",";
740740

741741
void printRowBegin(const std::string & EventName, const CoreCounterState & BeforeState, const CoreCounterState & AfterState, PCM* m)
742742
{
743743
printDateForCSV(CsvOutputType::Data);
744-
cout << EventName << sep << (1000ULL * getInvariantTSC(BeforeState, AfterState)) / m->getNominalFrequency() << sep << getInvariantTSC(BeforeState, AfterState);
744+
cout << EventName << separator << (1000ULL * getInvariantTSC(BeforeState, AfterState)) / m->getNominalFrequency() << separator << getInvariantTSC(BeforeState, AfterState);
745745
}
746746

747747

@@ -753,7 +753,7 @@ void printRow(const std::string & EventName, MetricFunc metricFunc, const std::v
753753
{
754754
if (!(m->isCoreOnline(core) == false || (show_partial_core_output && ycores.test(core) == false)))
755755
{
756-
cout << sep << metricFunc(BeforeState[core], AfterState[core]);
756+
cout << separator << metricFunc(BeforeState[core], AfterState[core]);
757757
}
758758
}
759759
cout << "\n";
@@ -791,7 +791,7 @@ void printTransposed(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<Cor
791791
{
792792
for (uint32 u = 0; u < maxUnit; ++u)
793793
{
794-
cout << sep << fixedMetricFunc(u, BeforeUncoreState[s], AfterUncoreState[s]);
794+
cout << separator << fixedMetricFunc(u, BeforeUncoreState[s], AfterUncoreState[s]);
795795
}
796796
}
797797
cout << "\n";
@@ -805,7 +805,7 @@ void printTransposed(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<Cor
805805
{
806806
for (uint32 u = 0; u < maxUnit; ++u)
807807
{
808-
cout << sep << metricFunc(u, i, BeforeUncoreState[s], AfterUncoreState[s]);
808+
cout << separator << metricFunc(u, i, BeforeUncoreState[s], AfterUncoreState[s]);
809809
}
810810
}
811811
cout << "\n";
@@ -911,9 +911,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
911911
if (BeforeState.size() > 0 && AfterState.size() > 0)
912912
{
913913
choose(outputType,
914-
[]() { cout << sep; },
914+
[]() { cout << separator; },
915915
[]() { cout << "ms,"; },
916-
[&]() { cout << (1000ULL * getInvariantTSC(BeforeState[0], AfterState[0])) / m->getNominalFrequency() << sep; });
916+
[&]() { cout << (1000ULL * getInvariantTSC(BeforeState[0], AfterState[0])) / m->getNominalFrequency() << separator; });
917917
}
918918
for (auto typeEvents : curPMUConfigs)
919919
{
@@ -944,9 +944,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
944944
auto print = [&](const std::string & metric, const uint64 value)
945945
{
946946
choose(outputType,
947-
[m, core]() { cout << "SKT" << m->getSocketId(core) << "CORE" << core << sep; },
948-
[&metric]() { cout << metric << sep; },
949-
[&value]() { cout << value << sep; });
947+
[m, core]() { cout << "SKT" << m->getSocketId(core) << "CORE" << core << separator; },
948+
[&metric]() { cout << metric << separator; },
949+
[&value]() { cout << value << separator; });
950950
};
951951
for (uint32 cnt = 0; cnt < 4; ++cnt)
952952
{
@@ -967,9 +967,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
967967
for (auto event : events)
968968
{
969969
choose(outputType,
970-
[m, core]() { cout << "SKT" << m->getSocketId(core) << "CORE" << core << sep; },
971-
[&event, &i]() { if (event.second.empty()) cout << "COREEvent" << i << sep; else cout << event.second << sep; },
972-
[&]() { cout << getNumberOfCustomEvents(i, BeforeState[core], AfterState[core]) << sep; });
970+
[m, core]() { cout << "SKT" << m->getSocketId(core) << "CORE" << core << separator; },
971+
[&event, &i]() { if (event.second.empty()) cout << "COREEvent" << i << separator; else cout << event.second << separator; },
972+
[&]() { cout << getNumberOfCustomEvents(i, BeforeState[core], AfterState[core]) << separator; });
973973
++i;
974974
}
975975
}
@@ -984,9 +984,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
984984
for (auto event : events)
985985
{
986986
choose(outputType,
987-
[s, l]() { cout << "SKT" << s << "LINK" << l << sep; },
988-
[&event, &i]() { if (event.second.empty()) cout << "M3UPIEvent" << i << sep; else cout << event.second << sep; },
989-
[&]() { cout << getM3UPICounter(l, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
987+
[s, l]() { cout << "SKT" << s << "LINK" << l << separator; },
988+
[&event, &i]() { if (event.second.empty()) cout << "M3UPIEvent" << i << separator; else cout << event.second << separator; },
989+
[&]() { cout << getM3UPICounter(l, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
990990
++i;
991991
}
992992
}
@@ -1002,9 +1002,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
10021002
for (auto event : events)
10031003
{
10041004
choose(outputType,
1005-
[s, l]() { cout << "SKT" << s << "LINK" << l << sep; },
1006-
[&event, &i]() { if (event.second.empty()) cout << "XPIEvent" << i << sep; else cout << event.second << sep; },
1007-
[&]() { cout << getXPICounter(l, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1005+
[s, l]() { cout << "SKT" << s << "LINK" << l << separator; },
1006+
[&event, &i]() { if (event.second.empty()) cout << "XPIEvent" << i << separator; else cout << event.second << separator; },
1007+
[&]() { cout << getXPICounter(l, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10081008
++i;
10091009
}
10101010
}
@@ -1019,17 +1019,17 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
10191019
if (fixedEvents.size())
10201020
{
10211021
choose(outputType,
1022-
[s, ch]() { cout << "SKT" << s << "CHAN" << ch << sep; },
1023-
[&fixedEvents]() { cout << "DRAMClocks" << fixedEvents[0].second << sep; },
1024-
[&]() { cout << getDRAMClocks(ch, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1022+
[s, ch]() { cout << "SKT" << s << "CHAN" << ch << separator; },
1023+
[&fixedEvents]() { cout << "DRAMClocks" << fixedEvents[0].second << separator; },
1024+
[&]() { cout << getDRAMClocks(ch, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10251025
}
10261026
int i = 0;
10271027
for (auto event : events)
10281028
{
10291029
choose(outputType,
1030-
[s, ch]() { cout << "SKT" << s << "CHAN" << ch << sep; },
1031-
[&event, &i]() { if (event.second.empty()) cout << "IMCEvent" << i << sep; else cout << event.second << sep; },
1032-
[&]() { cout << getMCCounter(ch, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1030+
[s, ch]() { cout << "SKT" << s << "CHAN" << ch << separator; },
1031+
[&event, &i]() { if (event.second.empty()) cout << "IMCEvent" << i << separator; else cout << event.second << separator; },
1032+
[&]() { cout << getMCCounter(ch, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10331033
++i;
10341034
}
10351035
}
@@ -1045,9 +1045,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
10451045
for (auto event : events)
10461046
{
10471047
choose(outputType,
1048-
[s, mc]() { cout << "SKT" << s << "MC" << mc << sep; },
1049-
[&event, &i]() { if (event.second.empty()) cout << "M2MEvent" << i << sep; else cout << event.second << sep; },
1050-
[&]() { cout << getM2MCounter(mc, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1048+
[s, mc]() { cout << "SKT" << s << "MC" << mc << separator; },
1049+
[&event, &i]() { if (event.second.empty()) cout << "M2MEvent" << i << separator; else cout << event.second << separator; },
1050+
[&]() { cout << getM2MCounter(mc, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10511051
++i;
10521052
}
10531053
}
@@ -1061,9 +1061,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
10611061
for (auto event : events)
10621062
{
10631063
choose(outputType,
1064-
[s]() { cout << "SKT" << s << sep; },
1065-
[&event, &i]() { if (event.second.empty()) cout << "PCUEvent" << i << sep; else cout << event.second << sep; },
1066-
[&]() { cout << getPCUCounter(i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1064+
[s]() { cout << "SKT" << s << separator; },
1065+
[&event, &i]() { if (event.second.empty()) cout << "PCUEvent" << i << separator; else cout << event.second << separator; },
1066+
[&]() { cout << getPCUCounter(i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10671067
++i;
10681068
}
10691069
}
@@ -1075,17 +1075,17 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
10751075
if (fixedEvents.size())
10761076
{
10771077
choose(outputType,
1078-
[s]() { cout << "SKT" << s << sep; },
1079-
[&fixedEvents]() { cout << "UncoreClocks" << fixedEvents[0].second << sep; },
1080-
[&]() { cout << getUncoreClocks(BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1078+
[s]() { cout << "SKT" << s << separator; },
1079+
[&fixedEvents]() { cout << "UncoreClocks" << fixedEvents[0].second << separator; },
1080+
[&]() { cout << getUncoreClocks(BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10811081
}
10821082
int i = 0;
10831083
for (auto event : events)
10841084
{
10851085
choose(outputType,
1086-
[s]() { cout << "SKT" << s << sep; },
1087-
[&event, &i]() { if (event.second.empty()) cout << "UBOXEvent" << i << sep; else cout << event.second << sep; },
1088-
[&]() { cout << getUBOXCounter(i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1086+
[s]() { cout << "SKT" << s << separator; },
1087+
[&event, &i]() { if (event.second.empty()) cout << "UBOXEvent" << i << separator; else cout << event.second << separator; },
1088+
[&]() { cout << getUBOXCounter(i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
10891089
++i;
10901090
}
10911091
}
@@ -1100,9 +1100,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
11001100
for (auto event : events)
11011101
{
11021102
choose(outputType,
1103-
[s, cbo]() { cout << "SKT" << s << "C" << cbo << sep; },
1104-
[&event, &i]() { if (event.second.empty()) cout << "CBOEvent" << i << sep; else cout << event.second << sep; },
1105-
[&]() { cout << getCBOCounter(cbo, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1103+
[s, cbo]() { cout << "SKT" << s << "C" << cbo << separator; },
1104+
[&event, &i]() { if (event.second.empty()) cout << "CBOEvent" << i << separator; else cout << event.second << separator; },
1105+
[&]() { cout << getCBOCounter(cbo, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
11061106
++i;
11071107
}
11081108
}
@@ -1118,9 +1118,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
11181118
for (auto event : events)
11191119
{
11201120
choose(outputType,
1121-
[s, stack]() { cout << "SKT" << s << "IRP" << stack << sep; },
1122-
[&event, &i]() { if (event.second.empty()) cout << "IRPEvent" << i << sep; else cout << event.second << sep; },
1123-
[&]() { cout << getIRPCounter(stack, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1121+
[s, stack]() { cout << "SKT" << s << "IRP" << stack << separator; },
1122+
[&event, &i]() { if (event.second.empty()) cout << "IRPEvent" << i << separator; else cout << event.second << separator; },
1123+
[&]() { cout << getIRPCounter(stack, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
11241124
++i;
11251125
}
11261126
}
@@ -1136,9 +1136,9 @@ void print(const PCM::RawPMUConfigs& curPMUConfigs, PCM* m, vector<CoreCounterSt
11361136
for (auto event : events)
11371137
{
11381138
choose(outputType,
1139-
[s, stack]() { cout << "SKT" << s << "IIO" << stack << sep; },
1140-
[&event, &i]() { if (event.second.empty()) cout << "IIOEvent" << i << sep; else cout << event.second << sep; },
1141-
[&]() { cout << getIIOCounter(stack, i, BeforeUncoreState[s], AfterUncoreState[s]) << sep; });
1139+
[s, stack]() { cout << "SKT" << s << "IIO" << stack << separator; },
1140+
[&event, &i]() { if (event.second.empty()) cout << "IIOEvent" << i << separator; else cout << event.second << separator; },
1141+
[&]() { cout << getIIOCounter(stack, i, BeforeUncoreState[s], AfterUncoreState[s]) << separator; });
11421142
++i;
11431143
}
11441144
}
@@ -1235,11 +1235,11 @@ int main(int argc, char* argv[])
12351235
}
12361236
else if (strncmp(*argv, "-l", 2) == 0) {
12371237
std::cout.imbue(std::locale(""));
1238-
sep = "\t";
1238+
separator = "\t";
12391239
continue;
12401240
}
12411241
else if (strncmp(*argv, "-tab", 4) == 0) {
1242-
sep = "\t";
1242+
separator = "\t";
12431243
continue;
12441244
}
12451245
else if (strncmp(*argv, "--yescores", 10) == 0 ||

0 commit comments

Comments
 (0)