用本机Linux命令通过百分比进行CPU应力测试

发布于 2025-01-22 21:23:43 字数 255 浏览 2 评论 0 原文

我目前正在运行以下命令以测试我的CPU:

md5sum /dev/zero

然后在30秒后杀死该过程。

pkill md5sum

我希望运行类似的命令,但它可以让我以一定比例的比例向CPU强调。我不能使用诸如压力ng之类的库,它必须能够使用像Ubuntu这样的基本Linux发行版运行。我也无法运行程序,我必须能够从命令行本身运行它。任何建议或帮助都将受到极大的赞赏。

I am currently running the following commands to stress test my CPU:

md5sum /dev/zero

Then I kill the process after 30 seconds.

pkill md5sum

I am looking to run a similar command but where it lets me stress the CPU by a certain percentage. I cannot use libraries like stress-ng, it has to be be able to run with basic linux distro like ubuntu. I also can't run a program as such, I have to be able to run it from the command line itself. Any suggestions or help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除会话 2025-01-29 21:23:43

我认为如果没有安装工具(例如 cpulimit ,ubuntu apt repo中可用)或使用 cpulimit )。 /man7/cgroups.7.html“ rel =“ nofollow noreferrer”> cgroups ,这很复杂,并且可能需要内核重建。

最近的标准功能是不错的过程优先级。因此,如果没有其他任何运行,它仍然会使用所有CPU时间,但是任何其他过程都将获得CPU优先级。

I don't believe this is possible without installing a tool (like cpulimit, available in Ubuntu apt repo) or by using cgroups, which is complex to configure and potentially requires kernel rebuilding.

The nearest standard feature is nice, which essentially sets the process priority. So without anything else running, it would still use all the CPU time, but any other processes would get CPU priority.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文