Linux:CPU基准测试需要更长的时间和不同的CPU利用率级别 [英] Linux: CPU benchmark requiring longer time and different CPU utilization levels
问题描述
为了进行研究,我需要一个CPU基准测试才能在Ubuntu笔记本电脑(Ubuntu 15.10,Memory 7.7 GiB,Intel Core i7-4500U CPU @ 1.80HGz x 4、64位)上进行一些实验.在理想的世界中,我希望有一个满足以下条件的基准:
For my research I need a CPU benchmark to do some experiments on my Ubuntu laptop (Ubuntu 15.10, Memory 7.7 GiB, Intel Core i7-4500U CPU @ 1.80HGz x 4, 64bit). In an ideal world, I would like to have a benchmark satisfying the following:
- CPU应该是官方基准测试,而不是出于透明度目的由我自己创建.
- 在笔记本电脑上执行基准测试所需的时间应至少5分钟(越多越好).
- 在整个执行过程中,基准测试应导致不同级别的CPU.例如,我不希望有一个基准可以使CPU利用率永久保持在100%左右-所以我想要一个基准,可以使CPU利用率随时间变化.
- The CPU should be an official benchmark rather than created by my own for transparency purposes.
- The time needed to execute the benchmark on my laptop should be at least 5 minutes (the more the better).
- The benchmark should result in different levels of CPU throughout execution. For example, I don't want a benchmark which permanently keeps the CPU utilization level at around 100% - so I want a benchmark which will make the CPU utilization vary over time.
尤其是第2点和第3点是我研究的关键.但是,到目前为止,我找不到任何合适的基准.到目前为止,我发现的基准包括:sysbench,CPU斐波那契,CPU Blowfish,CPU加密鱼,CPU N-Queens.但是,所有这些仅需要几秒钟即可完成,并且笔记本电脑上的利用率始终处于100%的水平.
Especially points 2 and 3 are really key for my research. However, I couldn't find any suitable benchmarks so far. Benchmarks I found so far include: sysbench, CPU Fibonacci, CPU Blowfish, CPU Cryptofish, CPU N-Queens. However, all of them just need a couple of seconds to complete and the utilization level on my laptop is at 100% constantly.
问题:有人知道适合我的基准吗?我也很高兴听到您有其他意见/问题.谢谢!
Question: Does anyone know about a suitable benchmark for me? I am also happy to hear any other comments/questions you have. Thank you!
推荐答案
要选择基准,您需要确切地知道要测量的内容.您的问题不包含此内容,因此没有任何人可以毫不犹豫地告诉您.
To choose a benchmark, you need to know exactly what you're trying to measure. Your question doesn't include that, so there's not much anyone can tell you without taking a wild guess.
如果您要衡量Turbo时钟速度如何工作,以使功率有限的CPU(如笔记本电脑)在突发性工作负载下运行得更快(例如,将Haswell与Skylake的新的和改进的电源管理进行比较),则可以运行一些功能微不足道的时间是1秒钟,关闭2秒,然后计算它管理的循环迭代次数.
If you're trying to measure how well Turbo clock speed works to make a power-limited CPU like your laptop run faster for bursty workloads (e.g. to compare Haswell against Skylake's new and improved power management), you could just run something trivial that's 1 second on, 2 seconds off, and count how many loop iterations it manages.
占空比和周期长度应为基准参数,因此可以进行绘制.例如具有非常快速的开/关周期, Skylake的速度更快,对Turbo的反应将更快地加速,而下降到最小功率的速度更快(为下一次爆发留出更多的余量).
The duty cycle and cycle length should be benchmark parameters, so you can make plots. e.g. with very fast on/off cycles, Skylake's faster-reacting Turbo will ramp up faster and drop down to min power faster (leaving more headroom in the bank for the next burst).
在演讲中的发言者(英特尔CPU电源管理的首席架构师)说,Javascript基准测试实际上具有足够的爆发力,可以使Skylake的电源管理提供可衡量的加速,这与大多数其他基准测试不同,后者只是将CPU固定为100%全程. 因此,如果您想使用众所周知的现成基准,请看看Javascript基准.
The speaker in that talk (the lead architect for power management on Intel CPUs) says that Javascript benchmarks are actually bursty enough for Skylake's power management to give a measurable speedup, unlike most other benchmarks which just peg the CPU at 100% the whole time. So maybe have a look at Javascript benchmarks, if you want to use well-known off-the-shelf benchmarks.
如果要自己滚动,请将循环承载的依赖关系链放入循环中,最好是在微体系结构之间的延迟不太变化的事物.一长串整数加法将起作用,Fibonacci是阻止编译器对其进行优化的好方法.选择一个固定的迭代计数以适合当前的CPU速度,或者每10M迭代检查一次时钟.
If rolling your own, put a loop-carried dependency chain in the loop, preferably with something that's not too variable in latency across microarchitectures. A long chain of integer adds would work, and Fibonacci is a good way to stop the compiler from optimizing it away. Either pick a fixed iteration count that works well for current CPU speeds, or check the clock every 10M iterations.
或设置一个计时器,该计时器将在一段时间后触发,并设置一个在循环内检查的标志. (例如来自信号处理程序).具体来说, alarm(2)
可能是一个不错的选择.记录一下您在此工作中进行了多少次迭代.
Or set a timer that will fire after some time, and have it set a flag that you check inside the loop. (e.g. from a signal handler). Specifically, alarm(2)
may be a good choice. Record how many iterations you did in this burst of work.
这篇关于Linux:CPU基准测试需要更长的时间和不同的CPU利用率级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!