Fixed the issue where CPU usage only shows a % #11613
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Q:你知道这是
pull request
吗?(使用 "x" 选择)之前提过 issues #11603
经过不断尝试,发现在
package/lean/autocore/files/x86/index.htm
文件中获取 CPU 使用率所在行的命令top -n 1 | grep 'CPU:'
会获取到两行数据,而另一行是grep CPU:
进程自身,最终导致 CPU 使用率计算报错,如下所示由于 x86 平台和 arm 平台使用的是不同的 index.htm 文件,获取 CPU 使用率的命令也不一样,再结合其他人的反馈,所以这个问题应该是只出现在 x86 平台上
虽然我也还是不知道为啥在编译时取消 autosamba 就会出现这个问题,但是修改匹配条件使用
grep -E '^CPU:'
匹配以CPU:
开头的行可修复此问题