int store_data(double time, int state, int cpu, struct cpuidle_datas *datas) { struct cpuidle_cstates *cstates = &datas->cstates[cpu]; struct cpufreq_pstate *pstate = datas->pstates[cpu].pstate; struct cpu_core *aff_core; struct cpu_physical *aff_cluster; /* ignore when we got a "closing" state first */ if (state == -1 && cstates->cstate_max == -1) return 0; if (record_cstate_event(cstates, time, state) == -1) return -1; /* Update P-state stats if supported */ if (pstate) { if (state == -1) cpu_pstate_running(datas, cpu, time); else cpu_pstate_idle(datas, cpu, time); } /* Update core and cluster */ aff_core = cpu_to_core(cpu, datas->topo); state = core_get_least_cstate(aff_core); if (record_cstate_event(aff_core->cstates, time, state) == -1) return -1; aff_cluster = cpu_to_cluster(cpu, datas->topo); state = cluster_get_least_cstate(aff_cluster); if (record_cstate_event(aff_cluster->cstates, time,state) == -1) return -1; return 0; }
int check_pstate_composite(struct cpuidle_datas *datas, int cpu, double time) { struct cpu_core *aff_core; struct cpu_physical *aff_cluster; unsigned int freq; aff_core = cpu_to_core(cpu, datas->topo); aff_cluster = cpu_to_cluster(cpu, datas->topo); freq = core_get_highest_freq(aff_core); if (aff_core->is_ht) { verbose_fprintf(stderr, 5, "Core %c%d: freq %9u, time %f\n", aff_cluster->physical_id + 'A', aff_core->core_id, freq, time); } if (record_group_freq(aff_core->pstates, time, freq) == -1) return -1; freq = cluster_get_highest_freq(aff_cluster); verbose_fprintf(stderr, 5, "Cluster %c: freq %9u, time %f\n", aff_cluster->physical_id + 'A', freq, time); return record_group_freq(aff_cluster->pstates, time, freq); }
static x86_core_t * pmGetCore(int cpu) { return(cpu_to_core(cpu)); }