3 ms·
How `pv -d` work ? Does it use perf probes or attach to the target PID ?
by xuhu 4y ago
How `pv -d` work ? Does it use perf probes or attach to the target PID ?
- remram 4y agoIt finds the file using /proc/<pid>/fd/<num> and watches its size grow. It doesn't work with pipes, devices, a file being overwritten (not appended to), or anything whose size doesn't grow.
- Jenda_ 4y agoIt does, even for reading (cat /dev/nvme0n1 > /dev/null). As per changelog: 1.5.2 - 10 February 2014 allow --watchfd to look at block devices You can see the position in /proc/<pid>/fdinfo/<num>
- cwillu 4y agoIt appears to monitor the contents of /proc/‹pid›/fdinfo/‹fd›