The function readIObytes() searches for all lines containing the string "nvme" and accumulates the values of field 6, i.e. sectors read.
I think this can cause incorrect measurements when more than one NVMe device is used by the system. While the benchmark is running on one drive, the OS or user processes may perform I/O on another NVMe drive. This way of accumulating the sectors read of all lines containing "nvme" will falsely add the I/O of other devices to the overall count.
To fix this, I think the most sane approach is to check whether the given path to file is either a regular file or a block device. In the former case, we should identify the block device that the file is stored on. In the latter case, the path directly identifies the block device. After identifying the block device that we are reading from, we can read its particular line from /proc/diskstats
The function
readIObytes()searches for all lines containing the string"nvme"and accumulates the values of field 6, i.e. sectors read.I think this can cause incorrect measurements when more than one NVMe device is used by the system. While the benchmark is running on one drive, the OS or user processes may perform I/O on another NVMe drive. This way of accumulating the sectors read of all lines containing
"nvme"will falsely add the I/O of other devices to the overall count.To fix this, I think the most sane approach is to check whether the given path to file is either a regular file or a block device. In the former case, we should identify the block device that the file is stored on. In the latter case, the path directly identifies the block device. After identifying the block device that we are reading from, we can read its particular line from
/proc/diskstats