Measuring the Average Unhalted Frequency(讲CPU_CLK_UNHALTED.THREAD和CPU_CLK_UNHALTED.REF关系)

本文详细介绍了现代CPU如何通过各种原因调整频率以节省电力或提升性能,并解释了如何计算CPU的平均未停止频率,这对于基准测试和性能分析至关重要。文中还提供了使用Intel VTune和Intel Performance Tuning Utility收集相关事件数据的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Measuring the Average Unhalted Frequency

Description



Most modern CPUs can change the CPU frequency for various reasons. To save power, Intel CPUs can reduce the CPU frequency. To improve performance, some Intel CPUs boost the frequency above the Time Stamp Counter (TSC) frequency. Along with knowing the %halted state (the percent of time the CPU is halted), it is useful to know the frequency at which the CPU is running. Particularly for benchmarking, when you might be trying to explain, say, a 10% variation in performance, it is essential to know the frequency of the CPU when you ran your benchmark.

Two of the fixed counters measure clockticks: CPU_CLK_UNHALTED.REF and CPU_CLK_UNHALTED.THREAD. CPU_CLK_UNHALTED.REF is incremented at the same frequency as the TSC. The TSC frequency is called the reference frequency and the TSC frequency doesn't vary. CPU_CLK_UNHALTED.THREAD is incremented at the frequency at which the CPU is running. Work gets done at the CPU frequency, not the TSC frequency. On Core2 CPUs, use CPU_CLK_UNHALTED.CORE instead of CPU_CLK_UNHALTED.THREAD.

The average unhalted frequency is computed as:

Average frequency = 
TSC_frequency * (CPU_CLK_UNHALTED.THREAD / CPU_CLK_UNHALTED.REF)


Measuring the average unhalted frequency



To use the above method, you need to collect CPU_CLK_UNHALTED.REF and CPU_CLK_UNHALTED.THREAD. Intel® VTune™ and Intel® Performance Tuning Utility (Intel® PTU) usually collect these events since the events are two of the fixed counters. 

If you are using Intel® VTune™ and Intel® Performance Tuning Utility (Intel® PTU) data, be clear whether you are looking at 'samples' or 'events'. You need use 'events'. You can compute the 

Events of CPU_CLK_UNHALTED.THREAD = 'samples of CPU_CLK_UNHALTED.THREAD' * sample_after_value (SAV) or Events of CPU_CLK_UNHALTED.REF = 'samples of CPU_CLK_UNHALTED.REF' * sample_after_value (SAV)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值