IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

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

    afatgoat发表于 2017-03-14 09:38:15
    love 0

    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帮助



沪ICP备19023445号-2号
友情链接