我想创建一个自动化程序来捕获程序运行时 CPU 的涡轮速度。
我的自动化脚本应该使用perl语言。
我确实尝试过使用:
system("script mytest.txt");
system("./turbostat");
当我执行这个程序时,只有脚本行起作用,但 Turbostat 不起作用。
有人可以建议我任何捕获涡轮速度的方法吗?
最佳答案
概要
use Sys::Info;
use Sys::Info::Constants qw( :device_cpu );
my $info = Sys::Info->new;
my $cpu = $info->device( CPU => %options );
printf "CPU: %s\n", scalar($cpu->identify) || 'N/A';
printf "CPU speed is %s MHz\n", $cpu->speed || 'N/A';
printf "There are %d CPUs\n" , $cpu->count || 1;
printf "CPU load: %s\n" , $cpu->load || 0;
关于linux - 运行程序时捕获涡轮速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24132324/