[v0.98][Refactoring] Use printWarn + strerror(errno) instead of perror. Use fallback in ppc in case total_cores cannot be retrieved

This commit is contained in:
Dr-Noob
2021-08-07 08:43:46 +02:00
parent c24dd7cbb6
commit 2b21326167
5 changed files with 19 additions and 21 deletions

View File

@@ -50,8 +50,8 @@ struct topology* get_topology_info(struct cache* cach) {
// 1. Total cores detection
if((topo->total_cores = sysconf(_SC_NPROCESSORS_ONLN)) == -1) {
perror("sysconf");
return NULL;
printWarn("sysconf(_SC_NPROCESSORS_ONLN): %s", strerror(errno));
topo->total_cores = 1; // fallback
}
// To find physical cores, we use topo->total_cores and core_ids