本文介绍了为什么 cpu-cycles 远小于 cpu 当前频率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 cpu 最大频率是 2.8GHZ,cpu 频率模式是性能,但是 cpu-cycles 从性能上只有 0.105GHZ,为什么??

cpu-cycles 事件是 0x3c,它是 CPU_CLK_UNHALTED.THREAD_P 还是 CPU_CLK_THREAD_UNHALTED.REF_XCLK?

我可以直接从 perf 读取 PMC 寄存器吗?

现在通过命令'mpstat',cpu-8的使用率达到了90%.

CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle8 0.00 0.00 0.98 0.00 0.00 0.00 0.00 89.22 0.00 9.808 0.00 0.00 0.99 0.00 0.00 0.00 0.00 88.12 0.00 10.89

CPU 为 Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz.

处理器:8vendor_id : 正版英特尔CPU系列:6型号 : 62型号名称 : Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz步数:4微码:0x428CPU 兆赫:2800.000缓存大小:25600 KB

我想通过 perf 了解一下 cpu-8.

perf stat -C 8CPU(s) 8"的性能计数器统计信息:8828.237941 任务时钟(毫秒)# 1.000 个 CPU11,550 次上下文切换 # 0.001 M/sec0 cpu-migrations # 0.000 K/秒0 页错误 # 0.000 K/秒926,167,840 个周期 # 0.105 GHz4,012,135,689 停顿周期前端 # 433.20% 前端周期空闲473,099,833 条指令 # 每个周期 0.51 insn# 每个insn 8.48 个停滞周期98,346,040 个分支 # 11.140 M/秒1,254,592 次分支未命中 # 占所有分支的 1.28%8.828177754 秒时间过去

cpu-cycles只有0.105GHZ,真的很奇怪.

我试图理解 cpu-cycles 的含义.

cat/sys/bus/event_source/devices/cpu/events/cpu-cycles事件=0x3c

我查找文档英特尔® 64 位和 IA-32 架构软件开发人员手册第 3 卷",第 19.6 节第 40 页.

我还检查了 cpu 频率设置,cpu 应该以最大频率运行.

cat scaling_governor表现猫缩放_governor表现

================================================/p>

我试试这个命令:

 taskset -c 8 压力 --cpu 1性能统计 -C 8 睡眠 10CPU(s) 8"的性能计数器统计信息:10000.633899 任务时钟(毫秒)# 1.000 个 CPU 使用1,823 次上下文切换 # 0.182 K/秒0 cpu-migrations # 0.000 K/秒8 个页面错误 # 0.001 K/sec29,792,267,638 个周期 # 2.979 GHz5,866,181,553 停顿周期前端 # 19.69% 前端周期空闲54,171,961,339 条指令 # 每个周期 1.82 insn# 每个insn 0.11 个停滞周期16,356,002,578 个分支 # 1635.497 M/秒33,041,249 次分支未命中 # 占所有分支的 0.20%10.000592203 秒时间过去了

关于我的环境的一些详细信息

我运行一个应用程序,我们称它为A",在虚拟机V"中,在主机H"中.

虚拟机由qume-kvm创建.

应用程序用于从网络接收数据包并进行处理.

解决方案

cpu-cycles 可能因 CPU 进入 C1 或 C2 空闲状态而被冻结.

My cpu max frequency is 2.8GHZ and cpu frequency mode is performance, but cpu-cycles is only 0.105GHZ from perf, why??

The cpu-cycles event is 0x3c, it is CPU_CLK_UNHALTED.THREAD_P or CPU_CLK_THREAD_UNHALTED.REF_XCLK ?

Could I read the PMC register from perf directly?

Now the usage of cpu-8 reaches 90% by the command 'mpstat'.

CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
 8    0.00    0.00    0.98    0.00    0.00    0.00    0.00   89.22    0.00    9.80
 8    0.00    0.00    0.99    0.00    0.00    0.00    0.00   88.12    0.00   10.89

The cpu is Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz.

processor       : 8
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
stepping        : 4
microcode       : 0x428
cpu MHz         : 2800.000
cache size      : 25600 KB

I want to get some idea about the cpu-8 by perf.

perf stat -C 8

Performance counter stats for 'CPU(s) 8':

   8828.237941      task-clock (msec)         #    1.000 CPUs utilized
        11,550      context-switches          #    0.001 M/sec
             0      cpu-migrations            #    0.000 K/sec
             0      page-faults               #    0.000 K/sec
   926,167,840      cycles                    #    0.105 GHz
 4,012,135,689      stalled-cycles-frontend   #  433.20% frontend cycles idle
   473,099,833      instructions              #    0.51  insn per cycle
                                              #    8.48  stalled cycles per insn
    98,346,040      branches                  #   11.140 M/sec
     1,254,592      branch-misses             #    1.28% of all branches

   8.828177754 seconds time elapsed

The cpu-cycles is only 0.105GHZ,it is really strange.

I try to understand the cpu-cycles meaning.

cat /sys/bus/event_source/devices/cpu/events/cpu-cycles
event=0x3c

I look up the document "Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3", at 19.6 session, page 40.

I also check the cpu frequency setting, the cpu should be running at the max frequency.

cat scaling_governor
performance

cat scaling_governor
performance

==============================================

I try this command:

 taskset -c 8 stress --cpu 1

perf stat -C 8 sleep 10

 Performance counter stats for 'CPU(s) 8':

      10000.633899      task-clock (msec)         #    1.000 CPUs utilized
             1,823      context-switches          #    0.182 K/sec
                 0      cpu-migrations            #    0.000 K/sec
                 8      page-faults               #    0.001 K/sec
    29,792,267,638      cycles                    #    2.979 GHz
     5,866,181,553      stalled-cycles-frontend   #   19.69% frontend cycles idle
    54,171,961,339      instructions              #    1.82  insn per cycle
                                                  #    0.11  stalled cycles per insn
    16,356,002,578      branches                  # 1635.497 M/sec
        33,041,249      branch-misses             #    0.20% of all branches

      10.000592203 seconds time elapsed


some detail information about my environment

I run a application, let's call it 'A', in a virtual machine 'V', in a host 'H'。

The virtual machine is created by qume-kvm.

The application is used to receive packets from network and deal with them.

解决方案

cpu-cycles could be frozen due to that CPU enters C1 or C2 idle state.

这篇关于为什么 cpu-cycles 远小于 cpu 当前频率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 14:53