mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
[v0.87][FREQ] Frequency in udev is now fetched as a per core basis. Before this commit, freq was always fetched from core 0. This allows ARM do detect the max frequency of each of the cores (which may or may not be the same in all of them)
This commit is contained in:
@@ -52,11 +52,11 @@ struct cache* get_cache_info(struct cpuInfo* cpu) {
|
||||
return cach;
|
||||
}
|
||||
|
||||
struct frequency* get_frequency_info(struct cpuInfo* cpu) {
|
||||
struct frequency* get_frequency_info(uint32_t core) {
|
||||
struct frequency* freq = malloc(sizeof(struct frequency));
|
||||
|
||||
freq->base = UNKNOWN_FREQ;
|
||||
freq->max = get_max_freq_from_file();
|
||||
freq->max = get_max_freq_from_file(core);
|
||||
|
||||
return freq;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ struct cpuInfo* get_cpu_info() {
|
||||
ptr->midr = midr_array[midr_idx];
|
||||
ptr->arch = get_uarch_from_midr(ptr->midr, ptr);
|
||||
|
||||
ptr->freq = get_frequency_info(ptr);
|
||||
ptr->freq = get_frequency_info(i); // TODO: wrong!
|
||||
ptr->cach = get_cache_info(ptr);
|
||||
ptr->topo = get_topology_info(ptr, ptr->cach);
|
||||
}
|
||||
@@ -210,18 +210,17 @@ char* get_soc_name(struct cpuInfo* cpu) {
|
||||
return cpu->soc_name;
|
||||
}
|
||||
|
||||
//TODO: Fix wrong implementation
|
||||
void print_debug(struct cpuInfo* cpu) {
|
||||
int ncores = get_ncores_from_cpuinfo();
|
||||
|
||||
if(ncores >= 10) {
|
||||
for(int i=0; i < ncores; i++) {
|
||||
printf("[Core %02d] 0x%.8X\n", i, cpu->midr);
|
||||
printf("[Core %02d] 0x%.8X %ld MHz\n", i, get_midr_from_cpuinfo(i), get_max_freq_from_file(i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int i=0; i < ncores; i++) {
|
||||
printf("[Core %d] 0x%.8X\n", i, cpu->midr);
|
||||
printf("[Core %d] 0x%.8X %ld MHz\n", i, get_midr_from_cpuinfo(i), get_max_freq_from_file(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
struct cpuInfo* get_cpu_info();
|
||||
struct cache* get_cache_info(struct cpuInfo* cpu);
|
||||
struct frequency* get_frequency_info(struct cpuInfo* cpu);
|
||||
struct frequency* get_frequency_info(uint32_t core);
|
||||
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach);
|
||||
|
||||
uint32_t get_nsockets(struct topology* topo);
|
||||
|
||||
Reference in New Issue
Block a user