-
Notifications
You must be signed in to change notification settings - Fork 286
/
signals.bt
executable file
·64 lines (60 loc) · 1.44 KB
/
signals.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/local/bin/bpftrace
/*
* signals - Summarize sent signals by target process.
*
* See BPF Performance Tools, Chapter 13, for an explanation of this tool.
*
* Copyright (c) 2019 Brendan Gregg.
* Licensed under the Apache License, Version 2.0 (the "License").
* This was originally created for the BPF Performance Tools book
* published by Addison Wesley. ISBN-13: 9780136554820
* When copying or porting, include this comment.
*
* 16-Feb-2019 Brendan Gregg Created this.
*/
BEGIN
{
printf("Counting signals. Hit Ctrl-C to end.\n");
// from /usr/include/asm-generic/signal.h:
@sig[0] = "0";
@sig[1] = "SIGHUP";
@sig[2] = "SIGINT";
@sig[3] = "SIGQUIT";
@sig[4] = "SIGILL";
@sig[5] = "SIGTRAP";
@sig[6] = "SIGABRT";
@sig[7] = "SIGBUS";
@sig[8] = "SIGFPE";
@sig[9] = "SIGKILL";
@sig[10] = "SIGUSR1";
@sig[11] = "SIGSEGV";
@sig[12] = "SIGUSR2";
@sig[13] = "SIGPIPE";
@sig[14] = "SIGALRM";
@sig[15] = "SIGTERM";
@sig[16] = "SIGSTKFLT";
@sig[17] = "SIGCHLD";
@sig[18] = "SIGCONT";
@sig[19] = "SIGSTOP";
@sig[20] = "SIGTSTP";
@sig[21] = "SIGTTIN";
@sig[22] = "SIGTTOU";
@sig[23] = "SIGURG";
@sig[24] = "SIGXCPU";
@sig[25] = "SIGXFSZ";
@sig[26] = "SIGVTALRM";
@sig[27] = "SIGPROF";
@sig[28] = "SIGWINCH";
@sig[29] = "SIGIO";
@sig[30] = "SIGPWR";
@sig[31] = "SIGSYS";
}
tracepoint:signal:signal_generate
{
@[@sig[args->sig], args->pid, args->comm] = count();
}
END
{
printf("\n@[SIGNAL, PID, COMM] = COUNT");
clear(@sig);
}