mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-26 00:10:38 +01:00
[v0.98][PPC] Basic support for topology detection
This commit is contained in:
@@ -34,11 +34,9 @@ int64_t get_freq(struct frequency* freq) {
|
||||
|
||||
#if defined(ARCH_X86) || defined(ARCH_PPC)
|
||||
char* get_str_cpu_name(struct cpuInfo* cpu) {
|
||||
return cpu->cpu_name;
|
||||
return cpu->cpu_name;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_X86
|
||||
char* get_str_sockets(struct topology* topo) {
|
||||
char* string = malloc(sizeof(char) * 2);
|
||||
int32_t sanity_ret = snprintf(string, 2, "%d", topo->sockets);
|
||||
|
||||
@@ -69,14 +69,16 @@ struct cache {
|
||||
struct topology {
|
||||
int32_t total_cores;
|
||||
struct cache* cach;
|
||||
#ifdef ARCH_X86
|
||||
uint32_t physical_cores;
|
||||
#if defined(ARCH_X86) || defined(ARCH_PPC)
|
||||
uint32_t physical_cores;
|
||||
uint32_t logical_cores;
|
||||
uint32_t smt_available; // Number of SMT that is currently enabled
|
||||
uint32_t smt_supported; // Number of SMT that CPU supports (equal to smt_available if SMT is enabled)
|
||||
uint32_t sockets;
|
||||
uint32_t smt_supported; // Number of SMT that CPU supports (equal to smt_available if SMT is enabled)
|
||||
#ifdef ARCH_X86
|
||||
uint32_t smt_available; // Number of SMT that is currently enabled
|
||||
struct apic* apic;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
struct features {
|
||||
@@ -143,16 +145,12 @@ struct cpuInfo {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef ARCH_X86
|
||||
#if defined(ARCH_X86) || defined(ARCH_PPC)
|
||||
char* get_str_cpu_name(struct cpuInfo* cpu);
|
||||
char* get_str_sockets(struct topology* topo);
|
||||
uint32_t get_nsockets(struct topology* topo);
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_PPC
|
||||
char* get_str_cpu_name(struct cpuInfo* cpu);
|
||||
#endif
|
||||
|
||||
VENDOR get_cpu_vendor(struct cpuInfo* cpu);
|
||||
int64_t get_freq(struct frequency* freq);
|
||||
|
||||
|
||||
@@ -568,11 +568,11 @@ 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);
|
||||
|
||||
/*
|
||||
@@ -589,7 +589,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);
|
||||
@@ -599,6 +599,7 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct colors* cs) {
|
||||
else {
|
||||
setAttribute(art,ATTRIBUTE_NCORES,n_cores);
|
||||
}
|
||||
/*
|
||||
setAttribute(art,ATTRIBUTE_AVX,avx);
|
||||
setAttribute(art,ATTRIBUTE_FMA,fma);
|
||||
setAttribute(art,ATTRIBUTE_L1i,l1i);
|
||||
|
||||
Reference in New Issue
Block a user