diff --git a/src/common/cpu.h b/src/common/cpu.h index 799e80a..bd61f8c 100644 --- a/src/common/cpu.h +++ b/src/common/cpu.h @@ -125,6 +125,8 @@ struct cpuInfo { uint32_t maxExtendedLevels; // Topology Extensions (AMD only) bool topology_extensions; +#elif ARCH_PPC + uint32_t pvr; #elif ARCH_ARM // Main ID register uint32_t midr; diff --git a/src/common/printer.c b/src/common/printer.c index a378eec..76f5d97 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -539,7 +539,6 @@ void print_ascii_ppc(struct ascii* art, uint32_t la) { uint32_t space_right; uint32_t space_up = (NUMBER_OF_LINES - art->n_attributes_set)/2; uint32_t space_down = NUMBER_OF_LINES - art->n_attributes_set - space_up; - bool flag = false; printf("\n"); for(uint32_t n=0;ntopo); char* max_frequency = get_str_freq(cpu->freq); - char* n_cores = get_str_topology(cpu, cpu->topo, false); - char* n_cores_dual = get_str_topology(cpu, cpu->topo, true); + char* n_cores = get_str_topology(cpu->topo, false); + char* n_cores_dual = get_str_topology(cpu->topo, true); char* altivec = get_str_altivec(cpu); char* l1i = get_str_l1i(cpu->cach); diff --git a/src/common/udev.h b/src/common/udev.h index 2c44a9a..76cd6be 100644 --- a/src/common/udev.h +++ b/src/common/udev.h @@ -35,5 +35,6 @@ long get_l1i_cache_size(uint32_t core); long get_l1d_cache_size(uint32_t core); long get_l2_cache_size(uint32_t core); long get_l3_cache_size(uint32_t core); +int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level); #endif diff --git a/src/ppc/ppc.c b/src/ppc/ppc.c index 2380bf1..00de361 100644 --- a/src/ppc/ppc.c +++ b/src/ppc/ppc.c @@ -73,7 +73,7 @@ struct cache* get_cache_info(struct cpuInfo* cpu) { return cach; } -struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach) { +struct topology* get_topology_info(struct cache* cach) { struct topology* topo = malloc(sizeof(struct topology)); init_topology_struct(topo, cach); @@ -142,9 +142,8 @@ static inline uint32_t mfpvr() { return pvr; } -struct uarch* get_cpu_uarch() { - uint32_t pvr = mfpvr(); - return get_uarch_from_pvr(pvr); +struct uarch* get_cpu_uarch(struct cpuInfo* cpu) { + return get_uarch_from_pvr(cpu->pvr); } struct frequency* get_frequency_info() { @@ -166,9 +165,10 @@ struct cpuInfo* get_cpu_info() { *ptr = false; } - cpu->arch = get_cpu_uarch(); + cpu->pvr = mfpvr(); + cpu->arch = get_cpu_uarch(cpu); cpu->freq = get_frequency_info(); - cpu->topo = get_topology_info(cpu, cpu->cach); + cpu->topo = get_topology_info(cpu->cach); cpu->cach = get_cache_info(cpu); feat->altivec = has_altivec(cpu->arch); @@ -219,7 +219,7 @@ char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64 return string; } -char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_socket) { +char* get_str_topology(struct topology* topo, bool dual_socket) { char* string; if(topo->smt_supported > 1) { uint32_t size = 3+3+17+1; @@ -242,5 +242,5 @@ char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_soc void print_debug(struct cpuInfo* cpu) { - printf("TODO\n"); + printf("PVR: 0x%.8X\n", cpu->pvr); } diff --git a/src/ppc/ppc.h b/src/ppc/ppc.h index 132e685..e9924f1 100644 --- a/src/ppc/ppc.h +++ b/src/ppc/ppc.h @@ -3,9 +3,9 @@ #include "../common/cpu.h" -struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach); struct cpuInfo* get_cpu_info(); char* get_str_altivec(struct cpuInfo* cpu); +char* get_str_topology(struct topology* topo, bool dual_socket); char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64_t freq); void print_debug(struct cpuInfo* cpu);