Debian Codegraph @

testsuite/systemtap.examples/process/syscalls_by_proc.stp

raw
1 #! /usr/bin/env stap
2
3 # Copyright (C) 2006 IBM Corp.
4 # Copyright (C) 2018-2019 Red Hat, Inc.
5 #
6 # This file is part of systemtap, and is free software. You can
7 # redistribute it and/or modify it under the terms of the GNU General
8 # Public License (GPL); either version 2, or (at your option) any
9 # later version.
10
11 #
12 # Print the system call count by process name in descending order.
13 #
14
15 global syscalls
16
17 probe begin {
18 print ("Collecting data... Type Ctrl-C to exit and display results\n")
19 }
20
21 probe syscall_any {
22 syscalls[execname()] <<< 1
23 }
24
25 probe end {
26 printf ("%-10s %-s\n", "#SysCalls", "Process Name")
27 foreach (proc in syscalls-)
28 printf("%-10d %-s\n", @sum(syscalls[proc]), proc)
29 }