Skip to content

Commit

Permalink
killsnoop: align numbers to the right
Browse files Browse the repository at this point in the history
  • Loading branch information
makelinux committed Jan 18, 2024
1 parent 07cae33 commit 2cfab3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ and this project adheres to
- [#2790](https://github.com/iovisor/bpftrace/pull/2790)
- Update mdflush.bt to use blkdev.h instead of genhd.h for non-BTF builds.
- [#2849](https://github.com/iovisor/bpftrace/pull/2849)
- Add milliseconds to timestamp in `threadsnoop.bt`
- Add milliseconds to timestamp and align numbers to the right in `threadsnoop.bt`
- [#2936](https://github.com/iovisor/bpftrace/pull/2936)

## [0.19.0] 2023-09-19

Expand Down
4 changes: 2 additions & 2 deletions tools/killsnoop.bt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
BEGIN
{
printf("Tracing kill() signals... Hit Ctrl-C to end.\n");
printf("%-15s %7s %-16s %-4s %-6s %s\n",
printf("%-15s %7s %-16s %4s %6s %s\n",
"TIME", "PID", "COMM", "SIG", "TPID", "RESULT");
}

Expand All @@ -31,7 +31,7 @@ tracepoint:syscalls:sys_enter_kill
tracepoint:syscalls:sys_exit_kill
/@tpid[tid]/
{
printf("%-15s %7d %-16s %-4d %-6d %d\n",
printf("%-15s %7d %-16s %4d %6d %6d\n",
strftime("%H:%M:%S.%f", nsecs),
pid, comm, @tsig[tid], @tpid[tid], args.ret);
delete(@tpid[tid]);
Expand Down
8 changes: 4 additions & 4 deletions tools/killsnoop_example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ This traces signals sent via the kill() syscall. For example:
# ./killsnoop.bt
Attaching 3 probes...
Tracing kill() signals... Hit Ctrl-C to end.
TIME PID COMM SIG TPID RESULT
00:09:37.345938 22485 bash 2 23856 0
00:09:40.838452 22485 bash 2 23856 -3
00:09:31.437104 22485 bash 15 23814 -3
TIME PID COMM SIG TPID RESULT
00:09:37.345938 22485 bash 2 23856 0
00:09:40.838452 22485 bash 2 23856 -3
00:09:31.437104 22485 bash 15 23814 -3

The first line showed a SIGINT (2) sent from PID 22485 (a bash shell) to
PID 23856. The result, 0, means success. The next line shows the same signal
Expand Down

0 comments on commit 2cfab3e

Please sign in to comment.