问题描述
程序正在大量从磁盘读取,但我不知道它正在读取哪个文件,也不知道它正在读取的代码的位置。
A program is massively reading from the disk but I don't know which file it is reading nor where in the code it is reading.
有什么类型的工具在linux上监视这个?
Is there any kind of tools on linux to monitor this ?
相关问题href =http://stackoverflow.com/questions/2878999/disk-io-profiler-for-existing-applications>现有应用程序的磁盘IO分析器
Related question (windows) : Disk IO profiler for existing applications
推荐答案
所以,你可以使用:
/ proc / PID / fd
或
lsof -p PID
So, you can use:/proc/PID/fd
orlsof -p PID
以了解您的进程使用哪个文件。
to know which file your process use.
例如,使用 lsof -p 27666
(假设27666是a.out程序的PID),您可以看到:
for example, with lsof -p 27666
(assume 27666 is the PID of a.out program) you can see this:
./a.out 22531 me 9w REG 8,5 131072 528280 /home/me/tmp/test.db
./a.out 22531 me 9r REG 8,5 131072 528280 /home/me/tmp/test2.db
这篇关于Linux上的C ++应用程序的磁盘IO概要分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!