Ruby: Call the system and get system information.

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

 

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