syscount(8)

πŸ“¦ version 1.0.1~20200130+git49b8cdf, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

syscount(8) πŸ’…

okay bestie, this is the syscount page from the System Manager's Manual β€” it counts system calls and it uses Linux perf_events. Let's get into it 🫢


✨ NAME ✨

syscount β€” count system calls. Uses Linux perf_events.


🌸 SYNOPSIS 🌸

syscount [-chv] [-t top] {-p PID|-d seconds|command}

πŸ¦‹ DESCRIPTION πŸ¦‹

So the tea is: this whole thing is a proof-of-concept that leans on perf_events capabilities for older kernel versions β€” the ones that don't have custom in-kernel aggregations yet. The moment those exist, this script can be substantially rewritten and improved, and it'll have lower overhead. Manifesting that fr fr ✨


πŸŽ€ REQUIREMENTS πŸŽ€

  • Linux perf_events β€” add linux-tools-common, run perf, then add any additional packages it requests.
  • Also needs awk.

no skipping the prerequisites bestie, it's giving "install first, cry later" 😭


πŸ’– OPTIONS πŸ’–

  • -c β€” Show counts by syscall name. This mode (without -v) uses in-kernel counts, which have lower overhead than the default mode. iconic behavior honestly
  • -h β€” Usage message. the "help me" button πŸ’…
  • -v β€” Verbose: include PID.
  • -p PID β€” Trace this process ID only.
  • -d seconds β€” Duration of trace in seconds.
  • command β€” Run and trace this command.

🌈 EXAMPLES 🌈

Trace and summarize syscalls by process name:

# syscount

Trace and summarize syscalls by syscall name (lower overhead):

# syscount -c

Trace for 5 seconds, showing by process name:

# syscount -d 5

Trace PID 932 only, and show by syscall name (lower overhead):

# syscount -cp 923

Execute the """ls""" command, and show by syscall name:

# syscount -c ls

⭐ FIELDS ⭐

  • PID β€” Process ID.
  • COMM β€” Process command name.
  • SYSCALL β€” Syscall name.
  • COUNT β€” Number of syscalls during tracing.

πŸ”₯ OVERHEAD πŸ”₯

Okay this part matters so vibe check your expectations: the modes that report syscall names only (-c, -cp PID, -cd secs) have lower overhead, because they use in-kernel counts. slay, less work for everyone ✨

Other modes β€” the ones reporting process IDs (-cv) or process names (the default) β€” create a perf.data file for post processing, and you will literally see messages about it doing that. Beware of the file size (test for short durations, or use -c to see counts based on in-kernel counters), and gauge overheads based on the perf.data size. ngl that file can get chunky πŸ™ˆ

Note that this script deliberately does not pipe perf record into perf script, which would avoid perf.data, because it can create a feedback loop where the perf script syscalls are recorded. Hopefully there will be a fix for this in a later perf version, so perf.data can be skipped, or other kernel features to aggregate by process name in-kernel directly (eg, via eBPF, ktap, or SystemTap). the way that's such a specific problem 😭

πŸ‘‘ SOURCE πŸ‘‘

This is from the perf-tools collection.

https://github.com/brendangregg/perf-tools

Also look under the examples directory for a text file containing example usage, output, and commentary for this tool. iykyk πŸ’…


🧚 OS 🧚

Linux obviously 🌸


πŸ’€ STABILITY πŸ’€

Unstable β€” in development. she's still growing bestie, be gentle 🫢


πŸ’œ AUTHOR πŸ’œ

Brendan Gregg


πŸ“ SEE ALSO πŸ“

iosnoop(8), iolatency(8), iostat(1)


and that's the whole page!! πŸ’– this one comes from USER COMMANDS and it's dated 2014-07-07 β€” yes she's a vintage icon, an OG, a legend, and she still counts your syscalls like it's nothing. mwah, go trace something cute βœ¨πŸ’…πŸŽ€