aboutsummaryrefslogtreecommitdiffstats
path: root/cputemp2maxfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'cputemp2maxfreq.c')
-rw-r--r--cputemp2maxfreq.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c
index 556e404..9600d13 100644
--- a/cputemp2maxfreq.c
+++ b/cputemp2maxfreq.c
@@ -85,15 +85,18 @@ int main(int argc,char **argv)
cpudata.min_freq=sysfs_read_long_int("/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq");
cpudata.max_freq=sysfs_read_long_int("/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq");
cpudata.scale_max=sysfs_read_long_int("/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq");
+ cpudata.transition_latency=sysfs_read_long_int("/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_transition_latency");
config.logger("CPU data:");
config.logger("Minimum frequency: %ld",cpudata.min_freq);
config.logger("Maximum frequency: %ld",cpudata.max_freq);
config.logger("Scaling maximum frequency: %ld",cpudata.scale_max);
+ config.logger("Transition Latency: %ld",cpudata.transition_latency);
if ((cpudata.min_freq<VALID_FREQ_MIN) || (cpudata.min_freq>VALID_FREQ_MAX) ||
(cpudata.max_freq<VALID_FREQ_MIN) || (cpudata.max_freq>VALID_FREQ_MAX) ||
- (cpudata.scale_max<VALID_FREQ_MIN) || (cpudata.scale_max>VALID_FREQ_MAX))
+ (cpudata.scale_max<VALID_FREQ_MIN) || (cpudata.scale_max>VALID_FREQ_MAX) ||
+ (cpudata.transition_latency<VALID_TRANS_MIN) || (cpudata.transition_latency>VALID_TRANS_MAX))
{
// If we have to fail now, there's not much we can do because we have no data
config.logger("Invalid CPU data, exiting");
@@ -166,7 +169,7 @@ int main(int argc,char **argv)
config.logger("Increase scaling_max_freq to %ld",newfreq);
// Set new value and validate
- if (cpufreq_set_long_int("scaling_max_freq",newfreq,100)<0)
+ if (cpufreq_set_long_int("scaling_max_freq",newfreq,cpudata.transition_latency)<0)
{
config.logger("Failed to set scaling_max_freq, exiting");
failsafe(1);
@@ -189,7 +192,7 @@ int main(int argc,char **argv)
config.logger("Decrease scaling_max_freq to %ld",newfreq);
// Set new value and validate
- if (cpufreq_set_long_int("scaling_max_freq",newfreq,100)<0)
+ if (cpufreq_set_long_int("scaling_max_freq",newfreq,cpudata.transition_latency)<0)
{
config.logger("Failed to set scaling_max_freq, exiting");
failsafe(1);