forked from enlightenment/enlightenment
slight improvement - average out freqs on all cores. some newer cpus
can have separate core freqs. dont get me started with this new turbo boost thing that the kernel doesnt even report corrently right now either. SVN revision: 54546
This commit is contained in:
parent
40c93a6dd1
commit
3e706de451
|
@ -524,6 +524,7 @@ _cpufreq_status_check_available(Status *s)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
// FIXME: this sssumes all cores accept the same freqs/ might be wrong
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
int freq, i;
|
int freq, i;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
@ -643,6 +644,7 @@ _cpufreq_status_check_current(Status *s)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int frequency = 0;
|
int frequency = 0;
|
||||||
|
int freqtot = 0;
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
int len = 4;
|
int len = 4;
|
||||||
|
|
||||||
|
@ -663,20 +665,31 @@ _cpufreq_status_check_current(Status *s)
|
||||||
s->active = 0;
|
s->active = 0;
|
||||||
|
|
||||||
_cpufreq_status_check_available(s);
|
_cpufreq_status_check_available(s);
|
||||||
f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r");
|
// average out frequencies of all cores
|
||||||
if (f)
|
for (i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
fgets(buf, sizeof(buf), f);
|
snprintf(buf, sizeof(buf), "/sys/devices/system/cpu/cpu%i/cpufreq/scaling_cur_freq", i);
|
||||||
buf[sizeof(buf) - 1] = 0;
|
f = fopen(buf, "r");
|
||||||
fclose(f);
|
if (f)
|
||||||
|
{
|
||||||
|
fgets(buf, sizeof(buf), f);
|
||||||
|
buf[sizeof(buf) - 1] = 0;
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
frequency = atoi(buf);
|
frequency = atoi(buf);
|
||||||
if (frequency != s->cur_frequency)
|
freqtot += frequency;
|
||||||
ret = 1;
|
s->active = 1;
|
||||||
s->cur_frequency = frequency;
|
}
|
||||||
s->active = 1;
|
else
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
if (i < 64) i++;
|
||||||
|
frequency = freqtot / i;
|
||||||
|
if (frequency != s->cur_frequency)
|
||||||
|
ret = 1;
|
||||||
|
s->cur_frequency = frequency;
|
||||||
|
|
||||||
|
// FIXME: this sssumes all cores are on the same governor
|
||||||
f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", "r");
|
f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed", "r");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue