实时监控CPU频率

实时监控CPU频率

我在 Ryzen 1700X 电脑上安装了 16.04 LTS。我可以通过运行命令来查看 16 个线程中每个线程的频率sudo cpupower monitor。除了频率之外,它还显示有关电源状态的信息,以及类似于 CPU 基本频率的信息。这是显示内容的示例:

|Mperf               
CPU | C0   | Cx   | Freq 
   0|  0.09| 99.91|  3493
   1|  0.04| 99.96|  3495
   2|  0.06| 99.94|  3498
   3|  0.06| 99.94|  3495
   4|  0.16| 99.84|  3439
   5|  0.05| 99.95|  3497
   6|  0.09| 99.91|  3494
   7|  0.10| 99.90|  3500
   8|  2.89| 97.11|  3474
   9|  0.13| 99.87|  3496
  10|  0.56| 99.44|  3485
  11|  0.07| 99.93|  3495
  12|  2.22| 97.78|  3474
  13|  0.19| 99.81|  3497
  14|  1.51| 98.49|  3490
  15|  0.01| 99.99|  3445

我有 2 个请求。第一个是,我如何才能半实时地监控这些数字;让计数器显示频率并每 1 秒更新一次?Bash 中是否有一个方便的功能可以频繁重复命令?

另一个问题是删除中间 2 列,甚至最好删除前 3 列,只留下“频率”列。这样我就可以轻松地将数据输入 Libreoffice Calc 并计算平均值和总和。

一个可能的替代方案是设置 psensor 以便能够实时读取频率。我能够通过 modprobe 命令让 psensor 显示温度和 CPU 使用率,但它不会显示频率波动(出于超频和微调目的,我对此很感兴趣)。

答案1

我最喜欢的工具是康基我把它分成了两部分,放在我的其中一台显示器的右侧:

CPU 省电.gif

我的代码只有 8 个 CPU,您必须对其进行修改以适应 16 个 CPU:

#------------+
# i7-6700 CPU|
#------------+
${color2}${voffset 5}Intel® i-7 6700HQ 3.5 GHz: ${color1}@  ${color green}${freq} MHz
${color}${goto 13}CPU 0 ${goto 81}${color green}${cpu cpu1}% ${goto 131}${color3}${cpubar cpu1 18}
${color}${goto 13}CPU 1 ${goto 81}${color green}${cpu cpu2}% ${goto 131}${color3}${cpubar cpu2 18}
${color}${goto 13}CPU 2 ${goto 81}${color green}${cpu cpu3}% ${goto 131}${color3}${cpubar cpu3 18}
${color}${goto 13}CPU 3 ${goto 81}${color green}${cpu cpu4}% ${goto 131}${color3}${cpubar cpu4 18}
${color}${goto 13}CPU 4 ${goto 81}${color green}${cpu cpu5}% ${goto 131}${color3}${cpubar cpu5 18}
${color}${goto 13}CPU 5 ${goto 81}${color green}${cpu cpu6}% ${goto 131}${color3}${cpubar cpu6 18}
${color}${goto 13}CPU 6 ${goto 81}${color green}${cpu cpu7}% ${goto 131}${color3}${cpubar cpu7 18}
${color}${goto 13}CPU 7 ${goto 81}${color green}${cpu cpu8}% ${goto 131}${color3}${cpubar cpu8 18}
${color1}All CPU ${color green}${cpu}% ${goto 131}${color1}Temp: ${color green}${hwmon 1 temp 1}°C ${goto 250}${color1}Up: ${color green}$uptime
${color green}$running_processes ${color1}running of ${color green}$processes ${color1}loaded processes.
${color}Load Avg. 1-5-15 minutes: ${alignr}${color green}${execpi .001 (awk '{printf "%s/", $1}' /proc/loadavg; grep -c processor /proc/cpuinfo;) | bc -l | cut -c1-4} ${execpi .001 (awk '{printf "%s/", $2}' /proc/loadavg; grep -c processor /proc/cpuinfo;) | bc -l | cut -c1-4} ${execpi .001 (awk '{printf "%s/", $3}' /proc/loadavg; grep -c processor /proc/cpuinfo;) | bc -l | cut -c1-4}

你可以找到数以千计的例子和解决方案Ubuntu 论坛对于 Conky 来说。

相关内容