如何配置文件I / O? [英] How can I profile file I/O?

查看:201
本文介绍了如何配置文件I / O?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的构建非常缓慢。这是一个用 Ant 构建的Java系统,我在Windows XP上运行我的。根据硬件的不同,可能需要5到15分钟才能完成。

Our build is annoyingly slow. It's a Java system built with Ant, and I'm running mine on Windows XP. Depending on the hardware, it can take between 5 to 15 minutes to complete.

查看计算机上的整体性能指标,以及将硬件差异与构建时间相关联,表明该进程受I / O限制。它还表明该过程比写作更多阅读。

Watching overall performance metrics on the machine, as well as correlating hardware differences with build times, indicates that the process is I/O bound. It also shows that the process does a lot more reading than writing.

但是,我还没有找到一种很好的方法来确定哪些文件正在阅读或书写,以及多少次。我的怀疑是,在我们的许多子项目和随后的编译器调用中,构建多次重读相同的常用库。

However, I haven't found a good way to determine which files are being read or written, and how many times. My suspicion is that with our many subprojects and subsequent invocations of the compiler, the build is re-reading the same commonly used libraries many times.

有哪些分析工具可以会告诉我一个给定的进程在使用哪些文件?免费是好的,但不是必需的。

What are some profiling tools that will tell me what a given process is doing with which files? Free is nice, but not essential.

使用进程监视器,正如Jon Skeet所建议的那样,我能够证实我的怀疑:几乎所有的磁盘活动都在读取和重新 - 使用JDK的rt.jar副本和列表顶部的其他库来读取库。我不能使RAM​​磁盘足够大以容纳我使用的所有库,但是将最热的库安装在RAM磁盘上会使构建时间缩短约40%;很明显,Windows文件系统缓存工作做得不够好,尽管我告诉Windows要优化它。

Using Process Monitor, as suggested by Jon Skeet, I was able to confirm my suspicion: almost all of the disk activity was reading and re-reading of libraries, with the JDK's copies of "rt.jar" and other libraries at the top of the list. I can't make a RAM disk large enough to hold all the libraries I used, but mounting the "hottest" libraries on a RAM disk cut build times by about 40%; clearly, Windows file system caching isn't doing a good enough job, even though I've told Windows to optimize for that.

我注意到一件有趣的事情是 JAR 文件只有几十个字节;通常有两个或三个,然后在文件中进一步跳过几千字节。它似乎不适合批量读取。

One interesting thing I noticed is that the typical 'read' operation on a JAR file is just a few dozen bytes; usually there are two or three of these, followed by a skip several kilobytes further on in the file. It appeared to be ill-suited to bulk reads.

我将使用所有我的第三方库进行更多测试一个闪存驱动器,看看有什么效果。

I'm going to do more testing with all of my third-party libraries on a flash drive, and see what effect that has.

推荐答案

如果需要它用于Windows ,SysInternals Process Monitor 应向您显示您需要了解的所有信息。您可以选择该过程,然后查看每个操作,并获取文件操作的摘要。

If you only need it for Windows, SysInternals Process Monitor should show you everything you need to know. You can select the process, then see each operation as it goes and get a summary of file operation as well.

这篇关于如何配置文件I / O?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆