mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-24 23:40:39 +01:00
Quick test
This commit is contained in:
@@ -431,6 +431,8 @@ struct cpuInfo* get_cpu_info(void) {
|
||||
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
|
||||
init_cpu_info(cpu);
|
||||
|
||||
test_thread_siblings_list();
|
||||
|
||||
#ifdef __linux__
|
||||
return get_cpu_info_linux(cpu);
|
||||
#elif defined __APPLE__ || __MACH__
|
||||
|
||||
@@ -315,6 +315,24 @@ int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level) {
|
||||
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) {
|
||||
// Get number of sockets using
|
||||
// /sys/devices/system/cpu/cpu*/topology/package_cpus
|
||||
|
||||
@@ -43,5 +43,6 @@ int get_num_sockets_package_cpus(struct topology* topo);
|
||||
int get_ncores_from_cpuinfo(void);
|
||||
char* get_field_from_cpuinfo(char* CPUINFO_FIELD);
|
||||
bool is_devtree_compatible(char* str);
|
||||
void test_thread_siblings_list(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user