1 Monitor
这个是 Mac 自带的监视器,可以监视 包括 CPU,内存在内的多种资源,使用简单,可以针对某个进程进行 Kill。

2 命令模式
2.1 system_profiler SPHardwareDataType

2.2 sysctl
sysctl 是可以提取内核状态的命令,具体用法可以 man sysctl 获取全面的手册,以下是从手册中获取的一些与 CPU 有关的指标。
| Name | Type | Changeable |
|---|---|---|
| hw.activecpu | integer | no |
| hw.cpu64bit_capable | integer | no |
| hw.cpufamily | integer | no |
| hw.cpufrequency | integer | no |
| hw.cpufrequency_max | integer | no |
| hw.cpufrequency_min | integer | no |
| hw.cpusubtype | integer | no |
| hw.cputhreadtype | integer | no |
| hw.cputype | integer | no |
| hw.l1dcachesize | integer | no |
| hw.l1icachesize | integer | no |
| hw.l2cachesize | integer | no |
| hw.l3cachesize | integer | no |
| hw.logicalcpu | integer | no |
| hw.logicalcpu_max | integer | no |
| hw.ncpu | integer | no |
| hw.physicalcpu | integer | no |
| hw.physicalcpu_max | integer | no |
获取系统最大的进程数。
sysctl kern.maxproc
为每个 uid 配置最大的进程数。
sysctl kern.maxprocperuid=1000
3 Summary
Mac 作为日常开发的主力机,理解其物理资源的查询方法是很有必要的。
博客介绍了 Mac 物理资源的查询方法。提到 Mac 自带监视器可监视 CPU、内存等多种资源,还能针对进程进行 Kill。此外,介绍了 system_profiler SPHardwareDataType 和 sysctl 两个命令,可提取内核状态,还能获取与 CPU 有关的指标等。
4696

被折叠的 条评论
为什么被折叠?



