linux - 运行程序时捕获涡轮速度

标签 linux perl automation

我想创建一个自动化程序来捕获程序运行时 CPU 的涡轮速度。

我的自动化脚本应该使用perl语言。

我确实尝试过使用:

system("script mytest.txt");
system("./turbostat");

当我执行这个程序时,只有脚本行起作用,但 Turbostat 不起作用。

有人可以建议我任何捕获涡轮速度的方法吗?

最佳答案

看看Sys::Info::Device::CPU模块。

概要

   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/

相关文章:

linux - 使用 NodeJS 访问系统图标

perl 催化剂 www 到非 www 重定向

perl - 如何使用包含元字符的参数使用 Perl(系统)执行外部程序“

java - 在 selenium 中处理多个浏览器的最佳方法是什么?

automation - Inno 安装程序 : How to automatically run program after/verysilent install?

c++ - Ncurses - 如何将某些内容添加到输入缓冲区中

c++ - 运行时链接库全局变量是否在加载了 dlopen 的插件之间共享?

c++ - 如何读取视频元数据(C/C++)?

perl - 如何在 Perl 中插入大量空格?

c# - 使用 EnvDTE 自动化 Visual Studio