Perf Trace: Analyze System Calls on Linux

Quick Linux Tip #84:

Question: Which system calls is a slow process making the most?

Try: sudo perf trace -p 3456 --summary

Info: perf trace offers lower overhead than strace. Using --summary aggregates syscall frequency and latency metrics (min/avg/max/stddev) to reveal true application execution bottlenecks.

Examples:

  • $ sudo perf trace -p 3456  # Trace live process system calls in real time
  • $ sudo perf stat -p 3456 sleep 10  # Count hardware and software performance counters
  • $ sudo strace -c -p 3456  # Legacy syscall profiling alternative

Note: Install via sudo apt install linux-tools-common. High time spent in epoll_wait or futex usually indicates an idle process waiting for event loops or locks, not active CPU slowness.




LinuxTeck.com
linuxteck:~$ sudo perf trace -p 3456 --summary
^C
  Summary of events:

mysqld (3456), 45623 events, 100.0%

  syscall             calls       total       min       avg       max     stddev
                              (msec)     (msec)    (msec)    (msec)       (%)
  -----------------  -----  --------  --------  --------  --------  --------
  futex               12345     2345.67     0.001     0.190    50.234    12.3%
  read                 8901      567.89     0.002     0.064     5.123     3.4%
  write                4567      234.56     0.003     0.051     2.345     5.6%
  openat               2341      123.45     0.005     0.053     1.234     4.2%
  epoll_wait            3456      890.12     0.001     0.258   100.567    23.4%
  pread64               1234       45.67     0.008     0.037     0.567     2.1%
linuxteck:~$

PREVIOUS ARTICLE Quick Linux Tip #83: How to Create an Encrypted Compressed Backup in Linux NEXT ARTICLE Quick Linux Tip #85: Count Error Occurrences in Linux Logs with Watch
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.