This commit is contained in:
Dr-Noob
2024-09-10 09:01:02 +01:00
parent ee69cffdbb
commit dc251a457e
4 changed files with 20 additions and 13 deletions

View File

@@ -514,7 +514,6 @@ struct cpuInfo* get_cpu_info(void) {
if(cpu->hybrid_flag) cpu->num_cpus = 2;
int32_t *max_freq_pp_vec = NULL;
struct cpuInfo* ptr = cpu;
for(uint32_t i=0; i < cpu->num_cpus; i++) {
int32_t first_core;
@@ -547,10 +546,9 @@ struct cpuInfo* get_cpu_info(void) {
ptr->feat = get_features_info(ptr);
ptr->arch = get_cpu_uarch(ptr);
// If accurate_pp is requested, we need to get the frequency
// after fetching the topology. Otherwise we can do it now.
// If accurate_pp is not requested, get it now.
if (!accurate_pp())
ptr->freq = get_frequency_info(ptr, accurate_pp(), max_freq_pp_vec);
ptr->freq = get_frequency_info(ptr, false, NULL);
if (cpu->cpu_name == NULL && ptr == cpu) {
// If we couldnt read CPU name from cpuid, infer it now
@@ -569,11 +567,19 @@ struct cpuInfo* get_cpu_info(void) {
// If topo is NULL, return early, as get_peak_performance
// requries non-NULL topology.
if(ptr->topo == NULL) return cpu;
}
// If accurate_pp is requested, we need to get the frequency
// after fetching the topology
if (accurate_pp())
ptr->freq = get_frequency_info(ptr, accurate_pp(), max_freq_pp_vec);
// If accurate_pp is requested, we need to get the frequency
// after fetching the topology for all CPU modules (this information
// is required by get_frequency_info)
if (accurate_pp()) {
int32_t *max_freq_pp_vec = NULL;
ptr = cpu;
for (uint32_t i=0; i < cpu->num_cpus; i++) {
ptr->freq = get_frequency_info(ptr, accurate_pp(), &max_freq_pp_vec);
ptr = ptr->next_cpu;
}
}
cpu->peak_performance = get_peak_performance(cpu, accurate_pp());
@@ -941,7 +947,7 @@ struct cache* get_cache_info(struct cpuInfo* cpu) {
return cach;
}
struct frequency* get_frequency_info(struct cpuInfo* cpu, bool accurate_pp, int32_t *max_freq_pp_vec) {
struct frequency* get_frequency_info(struct cpuInfo* cpu, bool accurate_pp, int32_t **max_freq_pp_vec) {
struct frequency* freq = emalloc(sizeof(struct frequency));
freq->measured = false;