Linux,监控文件的读取率

发布于 2024-09-02 07:24:48 字数 334 浏览 12 评论 0原文

我有一个自定义应用程序,其中打开了一堆文件。我可以使用“lsof”查看进程打开的文件句柄,并且可以使用“watch -d 'ls -alh'”查看正在访问的文件并查看 mtime/ctime。但是,我想查看读取/写入这些文件的数据速率。 IE:我需要确定是否正在以 100 Mbps 的速度读取一个文件并耗尽磁盘空间。随后,是否有多个文件正在以 1 Mbps 的速度写入?查看特定磁盘的吞吐量并不太有用,因为我需要缩小正在处理的文件的范围。

恐怕还有一个问题;理想情况下,我需要在不安装任何其他软件或编写脚本的情况下确定这一点......仅仅是因为这是那些“非常生产”的系统之一。

有人知道有办法吗?非常感谢您的任何建议。

I have a custom application which has a bunch of files open. I can see the file handles open by a process using "lsof" and I can see the files being accessed using "watch -d 'ls -alh'" and watching the mtime/ctime. However, I would like to see the rate of data that is being read/written to these files. IE: I need to determine if one file is being read at 100 Mbps and maxing out a disk. Subsequently, are there several files which are being written at 1 Mbps? Looking at the throughput for a specific disk isn't too useful as I need to narrow down which file is being hammered.

I'm afraid there is also a catch; ideally I need to determine this without installing any other software or writing scripts... Simply because this is one of those "very-production" systems.

Does anybody know of a way? Many thanks in advance for any suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-09-09 07:24:48

查看strace。它可以附加到正在运行的进程,并准确地告诉您它们执行的系统调用以及参数是什么 - 使用一个小的解释器脚本,您可以在观看时准确地推断出从哪个文件句柄读取了多少字节。

Check out strace. It can attach to running processes and tell you exactly what syscalls they execute and what the parameters are - with a small interpreter script, you can deduce exactly how many bytes are being read from which file handle while you watch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文