Debian Codegraph @

testsuite/systemtap.examples/process/sig_by_proc.stp

raw
1 #! /usr/bin/env stap
2
3 # Copyright (C) 2006 IBM Corp.
4 #
5 # This file is part of systemtap, and is free software. You can
6 # redistribute it and/or modify it under the terms of the GNU General
7 # Public License (GPL); either version 2, or (at your option) any
8 # later version.
9
10 #
11 # Print signal counts by process name in descending order.
12 #
13
14 global sigcnt, sig2name
15
16 probe begin {
17 print("Collecting data... Type Ctrl-C to exit and display results\n")
18 }
19
20 probe signal.send
21 {
22 sigcnt[execname(), pid_name, sig] <<< 1
23
24 if (!(sig in sig2name)) sig2name[sig] = sig_name
25 }
26
27 probe end
28 {
29 printf("%-16s %-16s %-16s %s\n",
30 "SENDER", "RECEIVER", "SIGNAL", "COUNT")
31
32 foreach ([snd_name, rcv_name, sig_num] in sigcnt-)
33 printf("%-16s %-16s %-16s %d\n",
34 snd_name, rcv_name, sig2name[sig_num],
35 @count(sigcnt[snd_name, rcv_name, sig_num]))
36 }