Red Hat Training

A Red Hat training course is available for RHEL 8

40.5. 与 SystemTap 跟踪最常用的系统调用

您可以使用 topsys.stp SystemTap 脚本列出系统每 5 秒间隔使用的前 20 个系统调用。它还列出了该期间每个系统调用使用的次数。

先决条件

流程

  • 运行 topsys.stp 脚本:

    # stap --example topsys.stp

    考虑以下示例:

    # stap -v --example topsys.stp

    其中 -v 使启动内核的输出结果可见。

    输出应类似于以下内容:

--------------------------------------------------------------
                  SYSCALL      COUNT
             gettimeofday       1857
                     read       1821
                    ioctl       1568
                     poll       1033
                    close        638
                     open        503
                   select        455
                    write        391
                   writev        335
                    futex        303
                  recvmsg        251
                   socket        137
            clock_gettime        124
           rt_sigprocmask        121
                   sendto        120
                setitimer        106
                     stat         90
                     time         81
                sigreturn         72
                    fstat         66
--------------------------------------------------------------