良好的数学函数会给 CPU 带来压力
任何人都知道哪些好的数学函数会对 CPU 造成大量负载。我想创建一个简单的程序,它只创建 X 秒的负载,而另一个程序则监视它。我只是在寻找功能,而不是实际的压力测试程序。
Anyone know any good math functions that causes a lot of load on the CPU. I am wanting to create a simple program the just creates load for X amount of seconds while another program monitors it. I'm just looking for functions, not actual stress testing programs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
计算机语言基准测试有很多基准测试,其中许多是基于数学的。这是一个很好的源代码,因为其中包含每个算法的源代码,并且每个基准测试都有数十种语言的实现。这样,您就可以使用您喜欢编译和运行的任何语言来实现。
The Computer Language Benchmark Game has quite a few benchmarks, many of which are math-based. It's a good source because the source code for each algorithm is included and there are implementations of each benchmark in dozens of languages. That way, you can just use the implementation in whatever language you're comfortable compiling and running.
尝试 Lucas-Lehmer 素性测试。它是在 Prime95 可执行文件中使用的,并且 Prime95 是 CPU 压力测试的相当标准。
Try the Lucas-Lehmer primality test. It's what's used in the Prime95 executable, and Prime95's fairly standard for CPU stress testing.
斐波那契的幼稚实现?像这样的东西:
A naive implementation of Fibonacci? Something like: