Mac CPU 相关

时间:2022-07-22
本文章向大家介绍Mac CPU 相关,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1 Monitor

https://support.apple.com/zh-cn/HT201464

这个是 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 作为日常开发的主力机,理解其物理资源的查询方法是很有必要的。