From faac9721077f80f1d4f37188ef0251e126563bae Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Sat, 31 Jul 2021 17:01:06 +0200 Subject: [PATCH] [v0.98][PPC] Add max frequency detection --- src/common/printer.c | 4 ++-- src/ppc/ppc.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/printer.c b/src/common/printer.c index 4ca4699..8829ca2 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -568,7 +568,7 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct colors* cs) { char* uarch = get_str_uarch(cpu); char* manufacturing_process = get_str_process(cpu); char* sockets = get_str_sockets(cpu->topo); - // char* max_frequency = get_str_freq(cpu->freq); + 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* cpu_name = get_str_cpu_name(cpu); @@ -587,7 +587,7 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct colors* cs) { }*/ setAttribute(art,ATTRIBUTE_UARCH,uarch); setAttribute(art,ATTRIBUTE_TECHNOLOGY,manufacturing_process); - //setAttribute(art,ATTRIBUTE_FREQUENCY,max_frequency); + setAttribute(art,ATTRIBUTE_FREQUENCY,max_frequency); uint32_t socket_num = get_nsockets(cpu->topo); if (socket_num > 1) { setAttribute(art, ATTRIBUTE_SOCKETS, sockets); diff --git a/src/ppc/ppc.c b/src/ppc/ppc.c index 513c321..4995490 100644 --- a/src/ppc/ppc.c +++ b/src/ppc/ppc.c @@ -6,6 +6,7 @@ #include "ppc.h" #include "udev.h" +#include "../common/udev.h" #define STRING_UNKNOWN "Unknown" @@ -118,6 +119,15 @@ struct uarch* get_cpu_uarch() { return get_uarch_from_pvr(pvr); } +struct frequency* get_frequency_info() { + struct frequency* freq = malloc(sizeof(struct frequency)); + + freq->max = get_max_freq_from_file(0, false); + freq->base = get_min_freq_from_file(0, false); + + return freq; +} + struct cpuInfo* get_cpu_info() { struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo)); struct features* feat = malloc(sizeof(struct features)); @@ -132,6 +142,7 @@ struct cpuInfo* get_cpu_info() { snprintf(cpu->cpu_name, strlen(STRING_UNKNOWN) + 1, STRING_UNKNOWN); cpu->arch = get_cpu_uarch(); + cpu->freq = get_frequency_info(); cpu->cach = get_cache_info(cpu); cpu->topo = get_topology_info(cpu, cpu->cach);