Ruby: Call the system and get system information.

后端开发   发布日期:2025年07月18日   浏览次数:289
1. Kill the task
cmd2="taskkill /F /IM typeperf.exe"stdout2=%x{#{cmd2}}
2. Start counters:
cmd="typeperf -cfc:\\test.txt>c:\\test3.csv"
3. Get system info:
require "sys/cpu"
include Sys
CPU.processors{ |cs|
    cs.members.each{ |m|
       puts "#{m}: " + cs[m].to_s
    }
}
puts "CPU Speed (Frequency): " +CPU.freq(0).to_s
puts "Load avg: " +CPU.load_avg.to_s
puts "Num CPU: " + CPU.num_cpu.to_s
puts "Type: " + CPU.type
puts "Model: " + CPU.model
puts "Architecture: " +CPU.architecture

 

以上就是Ruby: Call the system and get system information.的详细内容,更多关于Ruby: Call the system and get system information.的资料请关注九品源码其它相关文章!