Previous: nc_set_chunk_cache, Up: Datasets


2.21 Get the HDF5 Chunk Cache Settings for Future File Opens/Creates: nc_get_chunk_cache

This function gets the chunk cache settings for the HDF5 library. The settings apply for subsequent file opens/creates.

This affects the per-file chunk cache which the HDF5 layer maintains. The chunk cache size can be tuned for better performance.

For more information, see the documentation for the H5Pget_cache() function in the HDF5 library at the HDF5 website: http://hdfgroup.org/HDF5/.

Usage

     int nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float *preemptionp);
sizep
The total size of the raw data chunk cache will be put here. If NULL, will be ignored.
nelemsp
The number of chunk slots in the raw data chunk cache hash table will be put here. If NULL, will be ignored.
preemptionp
The preemption will be put here. The preemtion value is between 0 and 1 inclusive and indicates how much chunks that have been fully read are favored for preemption. A value of zero means fully read chunks are treated no differently than other chunks (the preemption is strictly LRU) while a value of one means fully read chunks are always preempted before other chunks. If NULL, will be ignored.

Return Codes

NC_NOERR
No error.

Example

This example is from libsrc4/tst_files.c:

     #include <netcdf.h>
        ...
        /* Retrieve the chunk cache settings, just for fun. */
        if (nc_get_chunk_cache(&cache_size_in, &cache_nelems_in,
     			  &cache_preemption_in)) ERR;
        if (cache_size_in != NEW_CACHE_SIZE || cache_nelems_in != NEW_CACHE_NELEMS ||
            cache_preemption_in != NEW_CACHE_PREEMPTION) ERR;
     
        ...