Input/Output Monitor User View
Steven, studying a new open-source tool just downloaded from sourceforge, and Leon, optimizing his production applications for better performance.
Issue this feature solves
- Which files has the program opened and where?
- Are there leaked (unclosed) file handles?
- How much I/O has the program done, for which files?
- Where (in time) are the I/O hot spots?
Lost config file
Steven has recently developed a new program that calculates Pi. This program reads number of iterations from config file. Steven wants to change this number, but he has forgotten where the config file is. Looking through 10 megabytes of source code to find config file name it too much for him, so he decides to try the I/O Monitor feature of NetBeans (he remembers reading something about this feature in last version's New and Noteworthy page). So Steven starts his program in NetBeans, clicks on "I/O Activity" button on I/O indicator and looks through the list of open files. He sees only some temp files. But he remembers that config file is read and closed at the very beginning of the program. So he clicks on a checkbox "Show closed files" and finds what he was looking for: "/home/steven/.picalcrc".
Leon is developing a commercial version of Pi calculator with some advanced features. One of the testers notify him that the program starts heavily crunching HDD starting from 10th second of execution, which negatively impacts Firefox performance which is running in parallel with Pi. Leon does not expect his program to do much I/O, so he decides to use NetBeans built-in I/O monitor to find out what happens. He starts his program in NetBeans, waits 10 seconds and indeed sees a significant raise on I/O indicator. Leon clicks on "I/O Activity" button and finds a list of open files. To his surprise, there is one open file and there are about 100 megabytes transferred. Leon clicks on the list item and is presented with a call stack where the file was created. It points to a function in 3rd-party library which Leon used in his program, but never suspected that is does any I/O. After reducing the number of calls to this function Leon fixed HDD crunching and made his program run 2 times faster.
Works only on Solaris (at least in this release).
Interesting values that deserve being shown on indicator:
- number of open files (F);
- number of read (r)/write(w) calls for last second;
- number of bytes read(R)/written(W) for last second.
These can be reduced to one cumulative value, e.g.
A * F + B * (r+w) + C * (R+W)
Details are a represented with a sortable list of open files:
File name | Open for | Transferred ------------------------------------------ /proc/self/stat | 0.01 s | 30 b /home/steven/data | 10 s* | 100 Mb
"*" means that the file is still open. There is a checkbox to show only open files.
Same file can be opened several times, so it can appear in the list several times.
After clicking on a list item user should be presented with call stacks where the file was opened and closed. How do we show them?