Skip to content

Commit ea3bc6c

Browse files
committed
added test-roc-find for numa check
1 parent feb1e69 commit ea3bc6c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/testROCfind.cxx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <ReadoutCard/CardFinder.h>
2+
3+
int main(int, char**) {
4+
// find roc cards
5+
auto cards = o2::roc::findCards();
6+
for (auto const& card : cards) {
7+
8+
9+
int numaNode = -1;
10+
std::string numapath = "/sys/bus/pci/devices/0000:"+ card.pciAddress.toString() + "/numa_node";
11+
FILE *fp = fopen(numapath.c_str(), "r");
12+
if (fp!=nullptr) {
13+
char buffer[16] = "";
14+
if (fgets(buffer, sizeof(buffer), fp) != nullptr) {
15+
if (sscanf(buffer, "%d", &numaNode) != 1) {
16+
numaNode = -1;
17+
}
18+
}
19+
fclose(fp);
20+
}
21+
22+
printf("%s %s #%s numa %d (roc lib) %d (/sys)\n", card.pciAddress.toString().c_str(),o2::roc::CardType::toString(card.cardType).c_str(), card.serialId.toString().c_str(), card.numaNode, numaNode);
23+
24+
}
25+
return 0;
26+
}

0 commit comments

Comments
 (0)