File access optimization discovery and visualization
Fast and Lean
Repeated Writes
When trying to merge two write calls interrupted by another function call by a different file access, you will find fewer cases in which you can merge the calls. The write calls alter the file, beginning from the position of the cursor at the time of the first function call until right before the cursor position after the second call. The function call between the write calls does not interfere if its byte area does not overlap the written areas (Figure 5). Any function not overlapping the written areas leads to mergeable write calls.
If any call happens inside the written areas, an optimization is impossible, because a merge would lead to inconsistencies.
Making It Better
The method discussed above forms the basis for determining whether repeated function calls can be merged to reduce their number and minimize the resulting overhead. Tracking programs and their file access patterns can be complicated and unintuitive while coding. Data about the file I/O of an application provides valuable insights into improving a program's efficiency. Tracing all function calls of a program with the necessary information and visualizing them helps you gain a deeper understanding, and the libiotrace [3] library can help.
libiotrace
This analysis tool monitors programs and collects file I/O profiling data, which sets a perfect entry point to analyze the program on the efficiency of its file I/O. The library traces file I/O-related function calls and provides additional useful information. It writes the data to an InfluxDB instance, storing each function call with the following details: the name of the function, its timestamp, the number of written or read bytes, the name of the file, and the related file handle.
Buy this article as PDF
(incl. VAT)
