فريد πŸ‡΅πŸ‡ΈπŸ‰πŸ”»: #!/usr/bin/perl use File::Slurp; use POSIX; use strict; use warnings; File::Slurp::write_file('/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor', 'schedutil'); my $available_frequencies = File::Slurp::read_file('/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies',...
Login

!/usr/bin/perl

use File::Slurp; use POSIX;

use strict; use warnings;

File::Slurp::write_file('/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor', 'schedutil'); my $available_frequencies = File::Slurp::read_file('/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies', { chomp => 1 }); $available_frequencies = [ split(/\s+/, $available_frequencies) ]; while (1) { my $temp = File::Slurp::read_file('/sys/class/thermal/thermal_zone0/temp', { chomp => 1, err_mode => 'quiet' }); my $freq = $available_frequencies->[0]; for (my $i = 0; $i < scalar(@{$available_frequencies}); $i++) { $freq = $available_frequencies->[$i] if $temp < (75 - $i) * 1000; } print sprintf("%s %s temp=%.1fΒ°C max_freq=%iMHz\n", $0, POSIX::strftime('%Y-%m-%dT%H:%M:%S', gmtime), $temp/1000, $freq/1000); File::Slurp::write_file('/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq', $freq); sleep 6; }