how to find out what is causing I/O in my application?
Good afternoon,
I inherited some C# code from years ago. I have refactored it a bit to be asynchronous. Evaluating the impact of my changes on the performance of the CPU, I used Process Explorer to watch, roughly, what my app was doing. To my surprise, it开发者_StackOverflow appears to be doing what Process Explorer reports as I/O. In general, this is related to Disk I/O or Network I/O. Based on what I can see of the code, I can't figure out an explicit call to either of those 2 I/O sources.
My question is: what is the best way to identify which section of code is causing I/O? We use dotTrace from JetBrains to profile our application, but, from what I can tell, it only handles CPU and Memory performance.
Thanks in advance for any pointers.
Regards,
Eric.
Process Monitor may be your answer. Refer to the following StackOverflow question for more information.
How can I profile file I/O?
Building on that answer, you may be able to search your solution for the filename of any commonly read or written files found with Process Monitor.
The stackshot method, also called random pausing, will find it, if it takes significant time.
If the I/O code is managed, you can load the symbols for the .net framework and set breakpoints in crucial functions (e.g. FileStream
constructors etc.)
It involves some guess work but can be informative if you succeed.
In addition to Process Monitor, I find the Resource Monitor on Win7 (also available under 'Performance and Reliability' I think on Vista) very useful for diagnosing I/O-related slowdowns. Switch to the disk view and sort by Read/Write or Total (win7 only). Also keep an eye on the list of files that appear.
精彩评论