インストール
sudo yum -y install git gcc
git clone https://github.com/tanelpoder/0xtools
cd 0xtools/
make
sudo make install
使ってみる
$ yes >> /dev/null &
[1] 26464
$ psn -p 26464 -G syscall,filename
Linux Process Snapper v0.18 by Tanel Poder [https://0x.tools]
Sampling /proc/syscall, stat for 5 seconds... finished.
=== Active Threads ======================================================
samples | avg_threads | comm | state | syscall | filename
-------------------------------------------------------------------------
100 | 1.00 | (yes) | Running (ON CPU) | [running] |
samples: 100 (expected: 100)
total processes: 1, threads: 1
runtime: 5.00, measure time: 0.08
$ schedlat 26464
SchedLat by Tanel Poder [https://0x.tools]
PID=26464 COMM=yes
TIMESTAMP %CPU %LAT %SLP
2020-11-29 15:20:39 100.3 0.0 -0.3
2020-11-29 15:20:40 99.9 0.0 0.1
2020-11-29 15:20:41 99.9 0.0 0.1
2020-11-29 15:20:42 100.3 0.0 -0.3
2020-11-29 15:20:43 99.9 0.0 0.1
2020-11-29 15:20:44 99.9 0.0 0.1
2020-11-29 15:20:45 99.9 0.0 0.1
2020-11-29 15:20:46 100.3 0.0 -0.3
^CTraceback (most recent call last):
File "/usr/bin/schedlat", line 36, in <module>
time.sleep(1)
KeyboardInterrupt
$ xcapture -c exe,kstack
0xTools xcapture v1.0 by Tanel Poder [https://0x.tools]
Sampling /proc...
DATE TIME PID TID USERNAME ST COMMAND SYSCALL WCHAN EXE KSTACK
2020-11-29 15:23:31.240 26464 26464 ec2-user R (yes) [running] 0 yes
DATE TIME PID TID USERNAME ST COMMAND SYSCALL WCHAN EXE KSTACK
2020-11-29 15:23:32.244 26464 26464 ec2-user R (yes) [running] 0 yes
DATE TIME PID TID USERNAME ST COMMAND SYSCALL WCHAN EXE KSTACK
2020-11-29 15:23:33.248 26464 26464 ec2-user R (yes) [running] 0 yes
環境
$ cat /etc/system-release
Amazon Linux release 2 (Karoo)
$ uname -r
4.14.193-149.317.amzn2.x86_64