[v0.85][ARM] Add SoC field in ARM and remove CPU Name field, which is only valid in x86. Fix Makefile for some strict compilers

This commit is contained in:
Dr-Noob
2020-11-18 23:22:26 +01:00
parent 8c11cb2422
commit c44a646cd1
8 changed files with 92 additions and 21 deletions

View File

@@ -87,6 +87,9 @@ struct cpuInfo* get_cpu_info() {
cpu->hv = malloc(sizeof(struct hypervisor));
cpu->hv->present = false;
cpu->soc = SOC_VENDOR_UNKNOWN;
cpu->soc_name = malloc(sizeof(char)*(strlen(STRING_UNKNOWN)+1));
snprintf(cpu->soc_name, strlen(STRING_UNKNOWN)+1, STRING_UNKNOWN);
return cpu;
}
@@ -188,6 +191,10 @@ char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64
return string;
}
char* get_soc_name(struct cpuInfo* cpu) {
return cpu->soc_name;
}
void free_topo_struct(struct topology* topo) {
free(topo);
}

View File

@@ -9,6 +9,7 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu);
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach);
uint32_t get_nsockets(struct topology* topo);
char* get_soc_name(struct cpuInfo* cpu);
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_socket);
char* get_str_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64_t freq);

View File

@@ -17,6 +17,7 @@ struct uarch {
MICROARCH uarch;
ISA isa;
char* uarch_str;
char* isa_str;
// int32_t process; process depends on SoC
};
@@ -154,14 +155,15 @@ static char* isas_string[] = {
#define UARCH_END else { printBug("Unknown microarchitecture detected: IM=0x%.8X P=0x%.8X V=0x%.8X R=0x%.8X", im, p, v, r); fill_uarch(arch, cpu, "Unknown", UARCH_UNKNOWN, CPU_VENDOR_UNKNOWN); }
void fill_uarch(struct uarch* arch, struct cpuInfo* cpu, char* str, MICROARCH u, VENDOR vendor) {
arch->uarch = u;
arch->isa = isas_uarch[arch->uarch];
cpu->cpu_vendor = vendor;
arch->uarch_str = malloc(sizeof(char) * (strlen(str)+1));
strcpy(arch->uarch_str, str);
arch->uarch = u;
cpu->cpu_vendor = vendor;
arch->isa = isas_uarch[arch->uarch];
char* isa_str = isas_string[arch->isa];
cpu->cpu_name = malloc(sizeof(char) * (strlen(isa_str)+1));
strcpy(cpu->cpu_name, isa_str);
arch->isa_str = malloc(sizeof(char) * (strlen(isas_string[arch->isa])+1));
strcpy(arch->isa_str, isas_string[arch->isa]);
}
/*