On 17/01/2025 11:56, Stefan Monnier wrote:
One of my main uses is when a tool is sitting there without giving me
any feedback and I'm wondering what it is that it's doing.
E.g. recently this occurred with `bup`, where I wanted to see if it was
mostly talking to the remote `bup`, or mostly reading local files or
writing local files (so as to guess in which phase
it is, and whether it's making progress), or none of the above
(e.g. because the network connection got stuck).
This sounds like debugging rather than monitoring.
You mentioned strace in the original post and it is often enough to
figure out if a process waiting for something. Sometimes ltrace may give
some hint if a process is busy, but is performing no system calls.
Opened local files may be obtained by
ls -l /proc/PID/fd
(for sockets lsof may be more informative), fdinfo sibling provides
position in opened files. If there is a network issue then send queue in
ss -tnp
output may be a hint.
If you really need progress reporting or logging that is not implemented
by the tool itself then the following links might be helpful, but it is
not a ready to use solution and I have not tried this approach
<https://github.com/iovisor/bcc>
BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and
more
https://brendangregg.com/dtrace.html