Quick test

This commit is contained in:
Dr-Noob
2024-08-29 08:08:40 +01:00
parent d2bda37e5f
commit a48e82cf6a
3 changed files with 21 additions and 0 deletions

View File

@@ -431,6 +431,8 @@ struct cpuInfo* get_cpu_info(void) {
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo)); struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
init_cpu_info(cpu); init_cpu_info(cpu);
test_thread_siblings_list();
#ifdef __linux__ #ifdef __linux__
return get_cpu_info_linux(cpu); return get_cpu_info_linux(cpu);
#elif defined __APPLE__ || __MACH__ #elif defined __APPLE__ || __MACH__

View File

@@ -315,6 +315,24 @@ int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level) {
return ret; return ret;
} }
// Just to check what is going on with missing thread_siblings_list
void test_thread_siblings_list(void) {
int num_cores = 12;
int filelen;
char* buf = NULL;
for(int i=0; i < num_cores; i++) {
char* path = ecalloc(500, sizeof(char));
sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", i);
if((buf = read_file(path, &filelen)) == NULL) {
printf("Could not open '%s'", path);
}
printf("%s: %s\n", path, buf);
}
}
int get_num_sockets_package_cpus(struct topology* topo) { int get_num_sockets_package_cpus(struct topology* topo) {
// Get number of sockets using // Get number of sockets using
// /sys/devices/system/cpu/cpu*/topology/package_cpus // /sys/devices/system/cpu/cpu*/topology/package_cpus

View File

@@ -43,5 +43,6 @@ int get_num_sockets_package_cpus(struct topology* topo);
int get_ncores_from_cpuinfo(void); int get_ncores_from_cpuinfo(void);
char* get_field_from_cpuinfo(char* CPUINFO_FIELD); char* get_field_from_cpuinfo(char* CPUINFO_FIELD);
bool is_devtree_compatible(char* str); bool is_devtree_compatible(char* str);
void test_thread_siblings_list(void);
#endif #endif