1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * Copyright by the Board of Trustees of the University of Illinois. * 4 * All rights reserved. * 5 * * 6 * This file is part of HDF5. The full HDF5 copyright notice, including * 7 * terms governing use, modification, and redistribution, is contained in * 8 * the COPYING file, which can be found at the root of the source code * 9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * 10 * If you do not have access to either file, you may request a copy from * 11 * help@hdfgroup.org. * 12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 13 14 /*------------------------------------------------------------------------- 15 * 16 * Created: H5PBprivate.h 17 * June 2014 18 * Mohamad Chaarawi 19 * 20 *------------------------------------------------------------------------- 21 */ 22 23 #ifndef _H5PBprivate_H 24 #define _H5PBprivate_H 25 26 /* Include package's public header */ 27 #ifdef NOT_YET 28 #include "H5PBpublic.h" 29 #endif /* NOT_YET */ 30 31 /* Private headers needed by this header */ 32 #include "H5private.h" /* Generic Functions */ 33 #include "H5Fprivate.h" /* File access */ 34 #include "H5FLprivate.h" /* Free Lists */ 35 #include "H5SLprivate.h" /* Skip List */ 36 37 38 /**************************/ 39 /* Library Private Macros */ 40 /**************************/ 41 42 43 /****************************/ 44 /* Library Private Typedefs */ 45 /****************************/ 46 47 /* Forward declaration for a page buffer entry */ 48 struct H5PB_entry_t; 49 50 /* Typedef for the main structure for the page buffer */ 51 typedef struct H5PB_t { 52 size_t max_size; /* The total page buffer size */ 53 size_t page_size; /* Size of a single page */ 54 unsigned min_meta_perc; /* Minimum ratio of metadata entries required before evicting meta entries */ 55 unsigned min_raw_perc; /* Minimum ratio of raw data entries required before evicting raw entries */ 56 unsigned meta_count; /* Number of entries for metadata */ 57 unsigned raw_count; /* Number of entries for raw data */ 58 unsigned min_meta_count; /* Minimum # of entries for metadata */ 59 unsigned min_raw_count; /* Minimum # of entries for raw data */ 60 61 H5SL_t *slist_ptr; /* Skip list with all the active page entries */ 62 H5SL_t *mf_slist_ptr; /* Skip list containing newly allocated page entries inserted from the MF layer */ 63 64 size_t LRU_list_len; /* Number of entries in the LRU (identical to slist_ptr count) */ 65 struct H5PB_entry_t *LRU_head_ptr; /* Head pointer of the LRU */ 66 struct H5PB_entry_t *LRU_tail_ptr; /* Tail pointer of the LRU */ 67 68 H5FL_fac_head_t *page_fac; /* Factory for allocating pages */ 69 70 /* Statistics */ 71 unsigned accesses[2]; 72 unsigned hits[2]; 73 unsigned misses[2]; 74 unsigned evictions[2]; 75 unsigned bypasses[2]; 76 } H5PB_t; 77 78 /*****************************/ 79 /* Library-private Variables */ 80 /*****************************/ 81 82 83 /***************************************/ 84 /* Library-private Function Prototypes */ 85 /***************************************/ 86 87 /* General routines */ 88 H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); 89 H5_DLL herr_t H5PB_flush(H5F_t *f); 90 H5_DLL herr_t H5PB_dest(H5F_t *f); 91 H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); 92 H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); 93 H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); 94 H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, 95 void *buf/*out*/); 96 H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, 97 const void *buf); 98 99 /* Statistics routines */ 100 H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); 101 H5_DLL herr_t H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], 102 unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]); 103 H5_DLL herr_t H5PB_print_stats(const H5PB_t *page_buf); 104 105 #endif /* !_H5PBprivate_H */ 106 107