macOS:几个用于排错的命令和工具

1. 系统程序:Console.app - 控制台

2. 系统程序:Activiy Monitor.app - 活动监视器

3. 运行命令:sudo fs_usage,使用control+c停止,它实时显示系统呼叫和文件页的错误等信息。

4. 运行命令:sudo syscallbypid.d,看看那个程序系统调用对多。

5. 运行命令:sysdiagnose。这个相当的强大而全面,它会生成一个系统全方面(可以说是最全)的测试报告,并以zip格式保存在/var/tmp/目录中。都包括什么,看看它的在线帮助信息吧:

           o   A spindump of the system
           o   Several seconds of fs_usage ouput
           o   Several seconds of top output
           o   Data about kernel zones
           o   Status of loaded kernel extensions
           o   Resident memory usage of user processes
           o   All system logs, kernel logs, opendirectory log, windowserver log, and log of power management events
           o   A System Profiler report
           o   All spin and crash reports
           o   Disk usage information
           o   I/O Kit registry information
           o   Network status
           o   If a specific process is supplied as an argument: list of malloc-allocated buffers in the process's heap is collected
           o   If a specific process is supplied as an argument: data about unreferenced malloc buffers in the process's memory is collected
           o   If a specific process is supplied as an argument: data about the virtual memory regions allocated in the process
           o   If Mail is the process supplied as an argument: your email address, account configuration, mailbox identifiers, the number of characters in the
               subject line of emails, the sent and received times of emails.

           不过注意的是,有些信息是指采集一小段时间的,所以要想详细获得具体的长时间段信息,需要单独运行。

6. 运行命令: sudo footprint -a。搜集每个CPU核的内存使用信息。

7. 运行命令: vm_stat。显示虚拟内存的统计信息

8. 运行命令: spindump。会在/var/tmp/DiagnosticReports/中生成当前系统的特征,比如核心以及驱动等

9. 运行命令: zprint。显示核心的情况

10运行命令:newproc.d和。newproc.d会监视新建的进程运行情况; creatbyproc.d使用进程名,它们都使用DTrace,所以在10.11以上版本需要之一SIP。

11运行命令:sar。搜集系统活动


对于众多命令,请详见在线man帮助

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值