mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-24 23:40:39 +01:00
[v1.00][ARM] Always consider two cores equals using the same criteria: if MIDR and freq are the same
This commit is contained in:
@@ -24,6 +24,10 @@
|
|||||||
#include "uarch.h"
|
#include "uarch.h"
|
||||||
#include "soc.h"
|
#include "soc.h"
|
||||||
|
|
||||||
|
bool cores_are_equal(int c1pos, int c2pos, uint32_t* midr_array, int32_t* freq_array) {
|
||||||
|
return midr_array[c1pos] == midr_array[c2pos] && freq_array[c1pos] == freq_array[c2pos];
|
||||||
|
}
|
||||||
|
|
||||||
struct cache* get_cache_info(struct cpuInfo* cpu) {
|
struct cache* get_cache_info(struct cpuInfo* cpu) {
|
||||||
struct cache* cach = emalloc(sizeof(struct cache));
|
struct cache* cach = emalloc(sizeof(struct cache));
|
||||||
init_cache_struct(cach);
|
init_cache_struct(cach);
|
||||||
@@ -47,7 +51,7 @@ struct frequency* get_frequency_info(uint32_t core) {
|
|||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, uint32_t* midr_array, int socket_idx, int ncores) {
|
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, uint32_t* midr_array, int32_t* freq_array, int socket_idx, int ncores) {
|
||||||
struct topology* topo = emalloc(sizeof(struct topology));
|
struct topology* topo = emalloc(sizeof(struct topology));
|
||||||
init_topology_struct(topo, cach);
|
init_topology_struct(topo, cach);
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, uint
|
|||||||
int cores_in_socket = 0;
|
int cores_in_socket = 0;
|
||||||
|
|
||||||
while(socket_idx + 1 > sockets_seen) {
|
while(socket_idx + 1 > sockets_seen) {
|
||||||
if(currrent_core_idx < ncores && midr_array[first_core_idx] == midr_array[currrent_core_idx]) {
|
if(currrent_core_idx < ncores && cores_are_equal(first_core_idx, currrent_core_idx, midr_array, freq_array)) {
|
||||||
currrent_core_idx++;
|
currrent_core_idx++;
|
||||||
cores_in_socket++;
|
cores_in_socket++;
|
||||||
}
|
}
|
||||||
@@ -93,10 +97,6 @@ int64_t get_peak_performance(struct cpuInfo* cpu) {
|
|||||||
return flops;
|
return flops;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cores_are_equal(int c1pos, int c2pos, uint32_t* midr_array, int32_t* freq_array) {
|
|
||||||
return midr_array[c1pos] == midr_array[c2pos] && freq_array[c1pos] == freq_array[c2pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t fill_ids_from_midr(uint32_t* midr_array, int32_t* freq_array, uint32_t* ids_array, int len) {
|
uint32_t fill_ids_from_midr(uint32_t* midr_array, int32_t* freq_array, uint32_t* ids_array, int len) {
|
||||||
uint32_t latest_id = 0;
|
uint32_t latest_id = 0;
|
||||||
bool found;
|
bool found;
|
||||||
@@ -231,7 +231,7 @@ struct cpuInfo* get_cpu_info_linux(struct cpuInfo* cpu) {
|
|||||||
ptr->feat = get_features_info();
|
ptr->feat = get_features_info();
|
||||||
ptr->freq = get_frequency_info(midr_idx);
|
ptr->freq = get_frequency_info(midr_idx);
|
||||||
ptr->cach = get_cache_info(ptr);
|
ptr->cach = get_cache_info(ptr);
|
||||||
ptr->topo = get_topology_info(ptr, ptr->cach, midr_array, i, ncores);
|
ptr->topo = get_topology_info(ptr, ptr->cach, midr_array, freq_array, i, ncores);
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->num_cpus = sockets;
|
cpu->num_cpus = sockets;
|
||||||
|
|||||||
Reference in New Issue
Block a user