如何从命令行获取CPU利用率,MAC中的RAM利用率 [英] How to get CPU utilisation, RAM utilisation in MAC from commandline

查看:132
本文介绍了如何从命令行获取CPU利用率,MAC中的RAM利用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用活动监视器可以看到CPU利用率.但是我想通过脚本获取我的远程系统的信息. top命令对我没有帮助.请以其他任何方式评论我.

I know that using Activity Monitor we can see CPU utilisation.But i want to get this information of my remote system through script. top command is not helpful for me. Please comment me any other way to get it.

推荐答案

在日志记录模式下对top的反对是什么?

What is the objection to top in logging mode?

top -l 1 | grep -E "^CPU|^Phys"

CPU usage: 3.27% user, 14.75% sys, 81.96% idle 
PhysMem: 5807M used (1458M wired), 10G unused.

或使用sysctl

sysctl vm.loadavg
vm.loadavg: { 1.31 1.85 2.00 }

或使用vm_stat

vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free:                                3569.
Pages active:                            832177.
Pages inactive:                          283212.
Pages speculative:                      2699727.
Pages throttled:                              0.
Pages wired down:                        372883.

这篇关于如何从命令行获取CPU利用率,MAC中的RAM利用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆