gpt4 book ai didi

linux - 有没有更好的方法来显示 tmux 中的 cpu 使用情况?

转载 作者:IT王子 更新时间:2023-10-29 00:40:42 27 4
gpt4 key购买 nike

这是一个可能会消耗大量 CPU 使用率的解决方案(从 this article 中窃取):

我的 Ubuntu 12 ec2 服务器有所不同,我必须使用 top -bn1 而不是 top -ln

这是我的相关 .tmux.conf 文件:

set -g status-right '#[fg=yellow]#[(getCpuUsage.sh)]'

它实际上每 2 秒调用一次 top 并输出大量信息。我认为应该有一种方法涉及更少的 cpu 消耗或使用一些标志将 top 的输出限制为仅 cpu 使用。

最佳答案

我用小tmux-mem-cpu-load C++程序。无论哪种方式,每次更新至少需要一个 fork/exec,但可能比调用 shell 更好。

关于linux - 有没有更好的方法来显示 tmux 中的 cpu 使用情况?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11558907/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com