|
NEP 4.3.0
NetCDF Expansion Pack
|
Helpers that make example benchmarks measure disk-bound I/O. More...
#include <errno.h>#include <fcntl.h>#include <unistd.h>Go to the source code of this file.
Functions | |
| static int | nep_perf_sync_file (const char *path) |
| Flush a closed file's data to the storage device. | |
| static int | nep_perf_drop_cache (const char *path) |
| Drop a file's pages from the page cache. | |
Helpers that make example benchmarks measure disk-bound I/O.
NetCDF/HDF5 writes return once the data is in the operating system's page cache, and a file read right after it was written is served from that cache. To time I/O against the storage device, a benchmark calls nep_perf_sync_file() after nc_close() inside the write timer, and nep_perf_drop_cache() before starting the read timer. Neither function needs root privileges.
|
inlinestatic |
Drop a file's pages from the page cache.
Opens path read-only, calls fsync() so no dirty pages remain, then posix_fadvise(POSIX_FADV_DONTNEED) on the whole file, so the next read comes from the storage device.
| path | Path of the file to drop from the cache. |
|
inlinestatic |
Flush a closed file's data to the storage device.
Opens path read-only, calls fsync() on it and closes it.
| path | Path of the file to flush. |