正常运行时间VS。 CPU 使用率最高:我应该相信什么,为什么会出现这种差异?

发布于 2024-12-21 08:44:27 字数 436 浏览 4 评论 0原文

我的嵌入式设备遇到一些性能问题:

# uptime 
 14:59:39 up  5:37, load average: 1.60, 1.50, 1.53

对于单核系统来说非常糟糕......:-p!然而,如果我检查顶级实用程序,我总是有 80% 左右的空闲时间!

Mem: 49020K used, 75960K free, 0K shrd, 0K buff, 21476K cached
CPU: 12.5% usr  4.8% sys  0.0% nic 81.7% idle  0.0% io  0.9% irq  0.0% sirq
Load average: 1.30 1.42 1.51 1/80 18696

读了一些文章后,我宁愿相信 uptime 命令。但为什么会出现这种差异呢?我的CPU真的闲置吗??

I'm having some performance issue on my embedded device:

# uptime 
 14:59:39 up  5:37, load average: 1.60, 1.50, 1.53

Very bad for a monocore system ... :-p! However if I check with the top utility, I always have an idle time around 80% !

Mem: 49020K used, 75960K free, 0K shrd, 0K buff, 21476K cached
CPU: 12.5% usr  4.8% sys  0.0% nic 81.7% idle  0.0% io  0.9% irq  0.0% sirq
Load average: 1.30 1.42 1.51 1/80 18696

After reading some articles, I would better believe the uptime command. But why this difference? Is my CPU really idle ??!

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

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

发布评论

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

评论(3

你怎么敢 2024-12-28 08:44:27

负载不仅衡量有多少进程处于 R 状态(可运行,可以使用 CPU 时间),还衡量有多少进程处于 D 状态(不可中断睡眠,通常等待 IO)。您可能有一个处于 D 状态的进程,该进程正在贡献负载,但不使用 cpu。此命令将向您显示当前所有导致负载的进程:

ps aux | awk '$8~/[RD]/'

查看该输出并查看是否有处于 D 状态的命令(在第 8 列中)

Load is not just a measure of how many processes in the R state (runnable, could use CPU time), but also processes in the D state (uninterruptable sleep, usually waiting for IO). You likely have a process in the D state which is contributing to load, but not using cpu. This command would show you all the current processes which are contributing to load:

ps aux | awk '$8~/[RD]/'

Have a look at that output and see if you have commands in the D state (in the 8th column)

念﹏祤嫣 2024-12-28 08:44:27

您最好了解“平均负载”代表什么。

简而言之,就是多个进程,在等待某个资源,而这个资源可能是CPU、硬盘、串口……

you'd better to learn what 'load average' stands for.

in short, it's a number of processes, waiting for some resource, and the resource may be CPU, HDD, serial port, ...

尤怨 2024-12-28 08:44:27

平均负载似乎有点高,这可能意味着 cpu 正忙于 I/O(磁盘/网络)或线程管理(您可能运行太多)。

The Load average seems a little high, that could meen that the cpu is busy with things like I/O(disk/network) or thread managment(you may have too meny running).

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