Skip to content

Commit edbdc73

Browse files
committed
Merge tag '2022-05-04' into push-2022-05-04
2022-05-04 Change-Id: I445612fad539ae5bb82388800fdb43c4a10a5b47
2 parents 78f12b9 + bb255f6 commit edbdc73

File tree

10 files changed

+103
-30
lines changed

10 files changed

+103
-30
lines changed

.bdsignore.all

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ My Inspector XE Results - pcm
3030
.*\.vcxproj.user
3131
.*\.log
3232
.*\.vcxproj.filters
33+
.*\.md
34+
.codedocs
35+
.cproject
36+
.project
37+
makefile

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
5252
message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
5353

5454
set(PCM_OPTIONAL_FLAGS "-Wall")
55-
set(CMAKE_CXX_FLAGS_RELEASE "${PCM_OPTIONAL_FLAGS} -O3")
55+
set(CMAKE_CXX_FLAGS_RELEASE "${PCM_OPTIONAL_FLAGS} -O3 -D_FORTIFY_SOURCE=1")
5656
set(CMAKE_CXX_FLAGS_DEBUG "${PCM_OPTIONAL_FLAGS} -O0 -g")
57-
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${PCM_OPTIONAL_FLAGS} -O3 -g")
57+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${PCM_OPTIONAL_FLAGS} -O3 -g -D_FORTIFY_SOURCE=1")
5858
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
5959
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
6060
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")

src/cpucounters.cpp

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,14 +2322,37 @@ bool PCM::isCPUModelSupported(const int model_)
23222322

23232323
bool PCM::checkModel()
23242324
{
2325-
if (cpu_model == NEHALEM) cpu_model = NEHALEM_EP;
2326-
if (cpu_model == ATOM_2) cpu_model = ATOM;
2327-
if (cpu_model == HASWELL_ULT || cpu_model == HASWELL_2) cpu_model = HASWELL;
2328-
if (cpu_model == BROADWELL_XEON_E3) cpu_model = BROADWELL;
2329-
if (cpu_model == ICX_D) cpu_model = ICX;
2330-
if (cpu_model == CML_1) cpu_model = CML;
2331-
if (cpu_model == ICL_1) cpu_model = ICL;
2332-
if (cpu_model == TGL_1) cpu_model = TGL;
2325+
switch (cpu_model)
2326+
{
2327+
case NEHALEM:
2328+
cpu_model = NEHALEM_EP;
2329+
break;
2330+
case ATOM_2:
2331+
cpu_model = ATOM;
2332+
break;
2333+
case HASWELL_ULT:
2334+
case HASWELL_2:
2335+
cpu_model = HASWELL;
2336+
break;
2337+
case BROADWELL_XEON_E3:
2338+
cpu_model = BROADWELL;
2339+
break;
2340+
case ICX_D:
2341+
cpu_model = ICX;
2342+
break;
2343+
case CML_1:
2344+
cpu_model = CML;
2345+
break;
2346+
case ICL_1:
2347+
cpu_model = ICL;
2348+
break;
2349+
case TGL_1:
2350+
cpu_model = TGL;
2351+
break;
2352+
case ADL_1:
2353+
cpu_model = ADL;
2354+
break;
2355+
}
23332356

23342357
if(!isCPUModelSupported((int)cpu_model))
23352358
{

src/cpucounters.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,7 @@ class PCM_API PCM
14011401
TGL = 140,
14021402
TGL_1 = 141,
14031403
ADL = 151,
1404+
ADL_1 = 154,
14041405
BDX = 79,
14051406
KNL = 87,
14061407
SKL = 94,

src/opCode-106.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,35 @@ ctr=0,ev_sel=0x83,umask=0x1,en=1,ch_mask=1,fc_mask=0x7,multiplier=4,divider=1,hn
55
ctr=1,ev_sel=0x83,umask=0x1,en=1,ch_mask=2,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part1 (2nd x4)
66
ctr=0,ev_sel=0x83,umask=0x1,en=1,ch_mask=4,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part2 (2nd x8/3rd x4)
77
ctr=1,ev_sel=0x83,umask=0x1,en=1,ch_mask=8,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part3 (4th x4)
8+
ctr=0,ev_sel=0x83,umask=0x1,en=1,ch_mask=16,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part4 (1st x16/x8/x4)
9+
ctr=1,ev_sel=0x83,umask=0x1,en=1,ch_mask=32,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part5 (2nd x4)
10+
ctr=0,ev_sel=0x83,umask=0x1,en=1,ch_mask=64,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part6 (2nd x8/3rd x4)
11+
ctr=1,ev_sel=0x83,umask=0x1,en=1,ch_mask=128,fc_mask=0x7,multiplier=4,divider=1,hname=IB write,vname=Part7 (4th x4)
812
ctr=0,ev_sel=0x83,umask=0x4,en=1,ch_mask=1,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part0 (1st x16/x8/x4)
913
ctr=1,ev_sel=0x83,umask=0x4,en=1,ch_mask=2,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part1 (2nd x4)
1014
ctr=0,ev_sel=0x83,umask=0x4,en=1,ch_mask=4,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part2 (2nd x8/3rd x4)
1115
ctr=1,ev_sel=0x83,umask=0x4,en=1,ch_mask=8,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part3 (4th x4)
16+
ctr=0,ev_sel=0x83,umask=0x4,en=1,ch_mask=16,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part4 (1st x16/x8/x4)
17+
ctr=1,ev_sel=0x83,umask=0x4,en=1,ch_mask=32,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part5 (2nd x4)
18+
ctr=0,ev_sel=0x83,umask=0x4,en=1,ch_mask=64,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part6 (2nd x8/3rd x4)
19+
ctr=1,ev_sel=0x83,umask=0x4,en=1,ch_mask=128,fc_mask=0x7,multiplier=4,divider=1,hname=IB read,vname=Part7 (4th x4)
1220
# Outbound (CPU MMIO to the PCIe device) payload events
1321
ctr=2,ev_sel=0x83,umask=0x80,en=1,ch_mask=1,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part0 (1st x16/x8/x4)
1422
ctr=3,ev_sel=0x83,umask=0x80,en=1,ch_mask=2,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part1 (2nd x4)
1523
ctr=2,ev_sel=0x83,umask=0x80,en=1,ch_mask=4,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part2 (2nd x8/3rd x4)
1624
ctr=3,ev_sel=0x83,umask=0x80,en=1,ch_mask=8,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part3 (4th x4)
25+
ctr=2,ev_sel=0x83,umask=0x80,en=1,ch_mask=16,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part4 (1st x16/x8/x4)
26+
ctr=3,ev_sel=0x83,umask=0x80,en=1,ch_mask=32,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part5 (2nd x4)
27+
ctr=2,ev_sel=0x83,umask=0x80,en=1,ch_mask=64,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part6 (2nd x8/3rd x4)
28+
ctr=3,ev_sel=0x83,umask=0x80,en=1,ch_mask=128,fc_mask=0x7,multiplier=4,divider=1,hname=OB read,vname=Part7 (4th x4)
1729
ctr=2,ev_sel=0xc0,umask=0x1,en=1,ch_mask=1,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part0 (1st x16/x8/x4)
1830
ctr=3,ev_sel=0xc0,umask=0x1,en=1,ch_mask=2,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part1 (2nd x4)
1931
ctr=2,ev_sel=0xc0,umask=0x1,en=1,ch_mask=4,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part2 (2nd x8/3rd x4)
2032
ctr=3,ev_sel=0xc0,umask=0x1,en=1,ch_mask=8,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part3 (4th x4)
33+
ctr=2,ev_sel=0xc0,umask=0x1,en=1,ch_mask=16,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part4 (1st x16/x8/x4)
34+
ctr=3,ev_sel=0xc0,umask=0x1,en=1,ch_mask=32,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part5 (2nd x4)
35+
ctr=2,ev_sel=0xc0,umask=0x1,en=1,ch_mask=64,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part6 (2nd x8/3rd x4)
36+
ctr=3,ev_sel=0xc0,umask=0x1,en=1,ch_mask=128,fc_mask=0x7,multiplier=4,divider=1,hname=OB write,vname=Part7 (4th x4)
2137
# IOMMU events
2238
ctr=0,ev_sel=0x40,umask=0x02,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=IOTLB Lookup,vname=Total
2339
ctr=1,ev_sel=0x40,umask=0x20,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=IOTLB Miss,vname=Total
@@ -26,4 +42,4 @@ ctr=3,ev_sel=0x41,umask=0x10,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1
2642
ctr=0,ev_sel=0x41,umask=0x08,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=1G Cache Hit,vname=Total
2743
ctr=1,ev_sel=0x41,umask=0x04,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=2M Cache Hit,vname=Total
2844
ctr=2,ev_sel=0x41,umask=0x02,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=4K Cache Hit,vname=Total
29-
ctr=3,ev_sel=0x41,umask=0x40,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=IOMMU Mem Access,vname=Total
45+
ctr=3,ev_sel=0x41,umask=0x40,en=1,ch_mask=0x0,fc_mask=0x0,multiplier=1,divider=1,hname=IOMMU Mem Access,vname=Total

src/pcm-iio.cpp

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ static const std::string icx_iio_stack_names[6] = {
8282
"IIO Stack 5 - CBDMA/DMI "
8383
};
8484

85+
static const std::string icx_d_iio_stack_names[6] = {
86+
"IIO Stack 0 - MCP ",
87+
"IIO Stack 1 - PCIe0 ",
88+
"IIO Stack 2 - CBDMA/DMI ",
89+
"IIO Stack 3 - PCIe2 ",
90+
"IIO Stack 4 - PCIe3 ",
91+
"IIO Stack 5 - PCIe1 "
92+
};
93+
8594
static const std::string snr_iio_stack_names[5] = {
8695
"IIO Stack 0 - QAT ",
8796
"IIO Stack 1 - CBDMA/DMI ",
@@ -111,6 +120,15 @@ static const std::map<int, int> icx_sad_to_pmu_id_mapping = {
111120
{ 5, 4 }
112121
};
113122

123+
static const std::map<int, int> icx_d_sad_to_pmu_id_mapping = {
124+
{ ICX_CBDMA_DMI_SAD_ID, 2 },
125+
{ 1, 5 },
126+
{ 2, 1 },
127+
{ ICX_MCP_SAD_ID, 0 },
128+
{ 4, 3 },
129+
{ 5, 4 }
130+
};
131+
114132
#define SNR_ACCELERATOR_PART_ID 4
115133

116134
#define SNR_ROOT_PORT_A_DID 0x334A
@@ -545,8 +563,16 @@ bool IPlatformMapping10Nm::getSadIdRootBusMap(uint32_t socket_id, std::map<uint8
545563
// Mapping for IceLake Server.
546564
class WhitleyPlatformMapping: public IPlatformMapping10Nm {
547565
private:
566+
const bool icx_d;
567+
const std::map<int, int>& sad_to_pmu_id_mapping;
568+
const std::string * iio_stack_names;
548569
public:
549-
WhitleyPlatformMapping() = default;
570+
WhitleyPlatformMapping() :
571+
icx_d(PCM::getInstance()->getCPUModelFromCPUID() == PCM::ICX_D),
572+
sad_to_pmu_id_mapping(icx_d ? icx_d_sad_to_pmu_id_mapping : icx_sad_to_pmu_id_mapping),
573+
iio_stack_names(icx_d ? icx_d_iio_stack_names : icx_iio_stack_names)
574+
{
575+
}
550576
~WhitleyPlatformMapping() = default;
551577
bool pciTreeDiscover(std::vector<struct iio_stacks_on_socket>& iios, uint32_t sockets_count) override;
552578
};
@@ -563,15 +589,15 @@ bool WhitleyPlatformMapping::pciTreeDiscover(std::vector<struct iio_stacks_on_so
563589

564590
{
565591
struct iio_stack stack;
566-
stack.iio_unit_id = icx_sad_to_pmu_id_mapping.at(ICX_MCP_SAD_ID);
567-
stack.stack_name = icx_iio_stack_names[stack.iio_unit_id];
592+
stack.iio_unit_id = sad_to_pmu_id_mapping.at(ICX_MCP_SAD_ID);
593+
stack.stack_name = iio_stack_names[stack.iio_unit_id];
568594
iio_on_socket.stacks.push_back(stack);
569595
}
570596

571597
for (auto sad_id_bus_pair = sad_id_bus_map.cbegin(); sad_id_bus_pair != sad_id_bus_map.cend(); ++sad_id_bus_pair) {
572598
int sad_id = sad_id_bus_pair->first;
573-
if (icx_sad_to_pmu_id_mapping.find(sad_id) ==
574-
icx_sad_to_pmu_id_mapping.end()) {
599+
if (sad_to_pmu_id_mapping.find(sad_id) ==
600+
sad_to_pmu_id_mapping.end()) {
575601
cerr << "Unknown SAD ID: " << sad_id << endl;
576602
return false;
577603
}
@@ -584,9 +610,9 @@ bool WhitleyPlatformMapping::pciTreeDiscover(std::vector<struct iio_stacks_on_so
584610
int root_bus = sad_id_bus_pair->second;
585611
if (sad_id == ICX_CBDMA_DMI_SAD_ID) {
586612
// There is one DMA Controller on each socket
587-
stack.iio_unit_id = icx_sad_to_pmu_id_mapping.at(sad_id);
613+
stack.iio_unit_id = sad_to_pmu_id_mapping.at(sad_id);
588614
stack.busno = root_bus;
589-
stack.stack_name = icx_iio_stack_names[stack.iio_unit_id];
615+
stack.stack_name = iio_stack_names[stack.iio_unit_id];
590616

591617
// PCH is on socket 0 only
592618
if (socket == 0) {
@@ -629,8 +655,8 @@ bool WhitleyPlatformMapping::pciTreeDiscover(std::vector<struct iio_stacks_on_so
629655
continue;
630656
}
631657
stack.busno = root_bus;
632-
stack.iio_unit_id = icx_sad_to_pmu_id_mapping.at(sad_id);
633-
stack.stack_name = icx_iio_stack_names[stack.iio_unit_id];
658+
stack.iio_unit_id = sad_to_pmu_id_mapping.at(sad_id);
659+
stack.stack_name = iio_stack_names[stack.iio_unit_id];
634660
for (int slot = 2; slot < 6; slot++) {
635661
struct pci pci;
636662
pci.bdf.busno = root_bus;
@@ -1009,7 +1035,7 @@ result_content get_IIO_Samples(PCM *m, const std::vector<struct iio_stacks_on_so
10091035
uint64 rawEvents[4] = {0};
10101036
std::unique_ptr<ccr> pccr(get_ccr(m, ctr.ccr));
10111037
rawEvents[ctr.idx] = pccr->get_ccr_value();
1012-
int stacks_count = (int)iios[0].stacks.size();
1038+
const int stacks_count = (int)m->getMaxNumOfIIOStacks();
10131039
before = new IIOCounterState[iios.size() * stacks_count];
10141040
after = new IIOCounterState[iios.size() * stacks_count];
10151041

src/pcm-memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void print_help(const string prog_name)
9494
cerr << " -pmm | /pmm | -pmem | /pmem => monitor PMM memory bandwidth and DRAM cache hit rate in Memory Mode (default on systems with PMM support).\n";
9595
cerr << " -mm => monitor detailed PMM Memory Mode metrics per-socket.\n";
9696
cerr << " -mixed => monitor PMM mixed mode (AppDirect + Memory Mode).\n";
97-
cerr << " -partial => monitor monitor partial writes instead of PMM (default on systems without PMM support).\n";
97+
cerr << " -partial => monitor partial writes instead of PMM (default on systems without PMM support).\n";
9898
cerr << " -nc | --nochannel | /nc => suppress output for individual channels.\n";
9999
cerr << " -csv[=file.csv] | /csv[=file.csv] => output compact CSV format to screen or\n"
100100
<< " to a file, in case filename is provided\n";

src/pcm-numa.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void print_usage(const string progname)
5454
cerr << " will read counters only after external program finishes\n";
5555
cerr << " Supported <options> are: \n";
5656
cerr << " -h | --help | /h => print this help and exit\n";
57+
cerr << " -pid PID | /pid PID => collect core metrics only for specified process ID\n";
5758
cerr << " -csv[=file.csv] | /csv[=file.csv] => output compact CSV format to screen or\n"
5859
<< " to a file, in case filename is provided\n";
5960
cerr << " -i[=number] | /i[=number] => allow to determine number of iterations\n";

src/pcm-tsx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ void print_usage(const string progname)
163163
cerr << " Supported <options> are: \n";
164164
cerr << " -h | --help | /h => print this help and exit\n";
165165
cerr << " -F | -force => force running this program despite lack of HW RTM support (optional)\n";
166+
cerr << " -pid PID | /pid PID => collect core metrics only for specified process ID\n";
166167
cerr << " -csv[=file.csv] | /csv[=file.csv] => output compact CSV format to screen or\n"
167168
<< " to a file, in case filename is provided\n";
168169
cerr << " -i[=number] | /i[=number] => allow to determine number of iterations\n";

tests/test.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ done
221221

222222

223223
# Check pcm-raw with TSV files
224-
./pcm-raw -r -e LD_BLOCKS.STORE_FORWARD -e CPU_CLK_UNHALTED.THREAD_ANY -e INST_RETIRED.ANY -e UNC_CHA_CLOCKTICKS -- sleep 1
225-
226-
if [ "$?" -ne "0" ]; then
227-
echo "Error in pcm-raw"
228-
rm -rf mapfile.csv
229-
cp "mapfile.csv_orig" "mapfile.csv"
230-
exit 1
231-
fi
224+
#./pcm-raw -r -e LD_BLOCKS.STORE_FORWARD -e CPU_CLK_UNHALTED.THREAD_ANY -e INST_RETIRED.ANY -e UNC_CHA_CLOCKTICKS -- sleep 1
225+
226+
#if [ "$?" -ne "0" ]; then
227+
# echo "Error in pcm-raw"
228+
# rm -rf mapfile.csv
229+
# cp "mapfile.csv_orig" "mapfile.csv"
230+
# exit 1
231+
#fi
232232
rm -rf mapfile.csv
233233
cp "mapfile.csv_orig" "mapfile.csv"
234234

0 commit comments

Comments
 (0)