Method: LinuxStat::CPU.min_freq
- Defined in:
- lib/linux_stat/cpu.rb
.min_freq ⇒ Object
Returns a Hash with max core frequencies corresponding to the CPUs.
For example:
LinuxStat::CPU.min_freq
=> {"cpu0"=>2000000, "cpu1"=>2000000, "cpu2"=>2000000, "cpu3"=>2000000}
If the information isn’t available, it will return an empty Hash.
221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/linux_stat/cpu.rb', line 221 def min_freq @@min_f ||= cpus.map { |x| [File.split(x)[-1], File.join(x, 'cpufreq/scaling_min_freq'.freeze)] } h = {} @@min_f.each { |id, file| h.merge!(id => IO.read(file).to_i) if File.readable?(file) } h end |