Skip to content

Commit ffc4926

Browse files
kostorrpippohub
authored andcommitted
Print device NUMA node with roc-list-cards
1 parent 90129c2 commit ffc4926

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/CardDescriptor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ struct CardDescriptor
2121
boost::optional<int> serialNumber;
2222
PciId pciId;
2323
PciAddress pciAddress;
24+
int32_t numaNode;
2425
};
2526

2627
} // namespace roc
2728
} // namespace AliceO2
2829

29-
#endif // ALICEO2_SRC_READOUTCARD_CARDDESCRIPTOR_H_
30+
#endif // ALICEO2_SRC_READOUTCARD_CARDDESCRIPTOR_H_

src/CommandLineUtilities/ProgramListCards.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class ProgramListCards: public Program
3838

3939
std::ostringstream table;
4040

41-
auto formatHeader = " %-3s %-6s %-10s %-11s %-11s %-8s %-25s %-17s\n";
42-
auto formatRow = " %-3s %-6s %-10s 0x%-9s 0x%-9s %-8s %-25s %-17s\n";
41+
auto formatHeader = " %-3s %-6s %-10s %-11s %-11s %-5s %-8s %-25s %-17s\n";
42+
auto formatRow = " %-3s %-6s %-10s 0x%-9s 0x%-9s %-5s %-8s %-25s %-17s\n";
4343
auto header = (boost::format(formatHeader)
44-
% "#" % "Type" % "PCI Addr" % "Vendor ID" % "Device ID" % "Serial" % "FW Version" % "Card ID").str();
44+
% "#" % "Type" % "PCI Addr" % "Vendor ID" % "Device ID" % "NUMA" % "Serial" % "FW Version" % "Card ID").str();
4545
auto lineFat = std::string(header.length(), '=') + '\n';
4646
auto lineThin = std::string(header.length(), '-') + '\n';
4747

@@ -53,6 +53,7 @@ class ProgramListCards: public Program
5353
const std::string na = "n/a";
5454
std::string firmware = na;
5555
std::string cardId = na;
56+
std::string numaNode = std::to_string(card.numaNode);
5657
try {
5758
Parameters params = Parameters::makeParameters(card.pciAddress, 2);
5859
params.setBufferParameters(buffer_parameters::Null());
@@ -66,7 +67,7 @@ class ProgramListCards: public Program
6667
}
6768

6869
auto format = boost::format(formatRow) % i % CardType::toString(card.cardType) % card.pciAddress.toString()
69-
% card.pciId.vendor % card.pciId.device;
70+
% card.pciId.vendor % card.pciId.device % card.numaNode;
7071

7172
if (auto serial = card.serialNumber) {
7273
format % serial.get();

src/Dummy/DummyDmaChannel.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace roc {
1414
namespace {
1515
CardDescriptor makeDummyDescriptor()
1616
{
17-
return {CardType::Dummy, ChannelFactory::getDummySerialNumber(), PciId {"dummy", "dummy"}, PciAddress {0,0,0}};
17+
return {CardType::Dummy, ChannelFactory::getDummySerialNumber(), PciId {"dummy", "dummy"}, PciAddress {0,0,0}, -1};
1818
}
1919

2020
constexpr size_t TRANSFER_QUEUE_SIZE = 16;

src/RocPciDevice.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ PciAddress addressFromDevice(Pda::PdaDevice::PdaPciDevice pciDevice){
5353
}
5454

5555
CardDescriptor defaultDescriptor() {
56-
return {CardType::Unknown, -1, {"unknown", "unknown"}, PciAddress(0,0,0)};
56+
return {CardType::Unknown, -1, {"unknown", "unknown"}, PciAddress(0,0,0), -1};
5757
}
5858
} // Anonymous namespace
5959

@@ -65,7 +65,7 @@ void RocPciDevice::initWithSerial(int serialNumber)
6565
for (auto& pciDevice : mPdaDevice->getPciDevices(mPdaDevice)) {
6666
if (type.getSerial(pciDevice) == serialNumber) {
6767
Utilities::resetSmartPtr(mPciDevice, pciDevice);
68-
mDescriptor = CardDescriptor{type.cardType, serialNumber, type.pciId, addressFromDevice(pciDevice)};
68+
mDescriptor = CardDescriptor{type.cardType, serialNumber, type.pciId, addressFromDevice(pciDevice), PciDevice_getNumaNode(pciDevice.get())};
6969
return;
7070
}
7171
}
@@ -87,7 +87,7 @@ void RocPciDevice::initWithAddress(const PciAddress& address)
8787
for (const auto& pciDevice : mPdaDevice->getPciDevices(mPdaDevice)) {
8888
if (addressFromDevice(pciDevice) == address) {
8989
Utilities::resetSmartPtr(mPciDevice, pciDevice);
90-
mDescriptor = CardDescriptor { type.cardType, type.getSerial(pciDevice), type.pciId, address };
90+
mDescriptor = CardDescriptor { type.cardType, type.getSerial(pciDevice), type.pciId, address, PciDevice_getNumaNode(pciDevice.get())};
9191
return;
9292
}
9393
}
@@ -132,7 +132,7 @@ std::vector<CardDescriptor> RocPciDevice::findSystemDevices()
132132
for (const auto& type : deviceTypes) {
133133
for (const auto& pciDevice : Pda::PdaDevice::getPciDevices(type.pciId)) {
134134
cards.push_back(CardDescriptor{type.cardType, type.getSerial(pciDevice), type.pciId,
135-
addressFromDevice(pciDevice)});
135+
addressFromDevice(pciDevice), PciDevice_getNumaNode(pciDevice.get())});
136136
}
137137
}
138138
return cards;
@@ -146,7 +146,7 @@ std::vector<CardDescriptor> RocPciDevice::findSystemDevices(int serialNumber)
146146
for (const auto& pciDevice : Pda::PdaDevice::getPciDevices(type.pciId)) {
147147
if (type.getSerial(pciDevice) == serialNumber) {
148148
cards.push_back(CardDescriptor{type.cardType, type.getSerial(pciDevice), type.pciId,
149-
addressFromDevice(pciDevice)});
149+
addressFromDevice(pciDevice), PciDevice_getNumaNode(pciDevice.get())});
150150
}
151151
}
152152
}
@@ -166,7 +166,7 @@ std::vector<CardDescriptor> RocPciDevice::findSystemDevices(const PciAddress& ad
166166
for (const auto& type : deviceTypes) {
167167
for (const auto& pciDevice : Pda::PdaDevice::getPciDevices(type.pciId)) {
168168
if (addressFromDevice(pciDevice) == address) {
169-
cards.push_back(CardDescriptor{type.cardType, type.getSerial(pciDevice), type.pciId, address});
169+
cards.push_back(CardDescriptor{type.cardType, type.getSerial(pciDevice), type.pciId, address, PciDevice_getNumaNode(pciDevice.get())});
170170
}
171171
}
172172
}

0 commit comments

Comments
 (0)