diff options
author | PA4WDH | 2023-05-27 10:47:05 +0200 |
---|---|---|
committer | PA4WDH | 2023-05-27 10:47:05 +0200 |
commit | bd331dbb839d7ee8b2d8abeb89d4fd650db58a9d (patch) | |
tree | 617c55fff6034445caf56ff4c65779bda5b3d7f5 /cputemp2maxfreq.c | |
parent | Added restart delay in Gentoo initscript (diff) | |
download | cputemp2maxfreq-bd331dbb839d7ee8b2d8abeb89d4fd650db58a9d.tar.gz cputemp2maxfreq-bd331dbb839d7ee8b2d8abeb89d4fd650db58a9d.tar.bz2 cputemp2maxfreq-bd331dbb839d7ee8b2d8abeb89d4fd650db58a9d.zip |
Use CPU Transition Latency as checkdelay when setting new scaling_max_freq
Diffstat (limited to 'cputemp2maxfreq.c')
-rw-r--r-- | cputemp2maxfreq.c | 9 |
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); |