upscaledb  2.1.13
upscaledb_int.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2016 Christoph Rupp (chris@crupp.de).
3  * All Rights Reserved.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * See the file COPYING for License information.
16  */
17 
29 #ifndef UPS_UPSCALEDB_INT_H
30 #define UPS_UPSCALEDB_INT_H
31 
32 #include <ups/upscaledb.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
44 #define ups_key_get_intflags(key) (key)->_flags
45 
53 #define ups_key_set_intflags(key, f) (key)->_flags=(f)
54 
80 
101 
103 #define UPS_PRINT_GRAPH 1
104 
117 ups_set_context_data(ups_db_t *db, void *data);
118 
134 
144 
145 typedef struct min_max_avg_u32_t {
149  uint32_t _total; /* for calculating the average */
150  uint32_t _instances; /* for calculating the average */
152 
153 /* btree metrics */
154 typedef struct btree_metrics_t {
155  /* the database name of the btree */
157 
158  /* number of pages */
160 
161  /* number of keys */
163 
164  /* total btree space, including overhead */
166 
167  /* static overhead per page */
169 
170  /* number of keys stored per page (w/o duplicates) */
172 
173  /* payload storage assigned to the KeyLists */
175 
176  /* payload storage assigned to the RecordLists */
178 
179  /* storage assigned to the Indices (if available) */
181 
182  /* storage assigned to the Indices (if available) */
184 
185  /* unused storage (i.e. gaps between pages, underfilled blocks etc) */
187 
188  /* unused storage (i.e. gaps between pages, underfilled blocks etc) */
190 
191  /* number of blocks per page (if available) */
193 
194  /* block sizes (if available) */
197 
210 #define UPS_METRICS_VERSION 9
211 
212 typedef struct ups_env_metrics_t {
213  /* the version indicator - must be UPS_METRICS_VERSION */
215 
216  /* number of total allocations for the whole lifetime of the process */
218 
219  /* currently active allocations for the whole process */
221 
222  /* current amount of memory allocated and tracked by the process
223  * (excludes memory used by the kernel or not allocated with
224  * malloc/free) */
226 
227  /* peak usage of memory (for the whole process) */
229 
230  /* the heap size of this process */
232 
233  /* amount of pages fetched from disk */
235 
236  /* amount of pages written to disk */
238 
239  /* number of index pages in this Environment */
241 
242  /* number of blob pages in this Environment */
244 
245  /* number of page-manager pages in this Environment */
247 
248  /* number of successful freelist hits */
250 
251  /* number of freelist misses */
253 
254  /* number of successful cache hits */
256 
257  /* number of cache misses */
259 
260  /* number of blobs allocated */
262 
263  /* number of blobs read */
265 
266  /* (global) number of btree page splits */
268 
269  /* (global) number of btree page merges */
271 
272  /* (global) number of extended keys */
274 
275  /* (global) number of extended duplicate tables */
277 
278  /* number of bytes that the log/journal flushes to disk */
280 
281  /* PRO: log/journal bytes before compression */
283 
284  /* PRO: log/journal bytes after compression */
286 
287  /* PRO: record bytes before compression */
289 
290  /* PRO: record bytes after compression */
292 
293  /* PRO: key bytes before compression */
295 
296  /* PRO: key bytes after compression */
298 
299  /* PRO: set to the max. SIMD lane width (0 if SIMD is not available) */
301 
302  /* btree metrics for leaf nodes */
304 
305  /* btree metrics for internal nodes */
307 
308  // PRO: set to true if AVX is enabled
310 
312 
318 
324 ups_is_debug();
325 
330 ups_calc_compare_name_hash(const char *zname);
331 
337 
342 #ifdef __cplusplus
343 } // extern "C"
344 #endif
345 
346 #endif /* UPS_UPSCALEDB_INT_H */
uint64_t page_count_type_page_manager
UPS_EXPORT uint32_t UPS_CALLCONV ups_calc_compare_name_hash(const char *zname)
uint64_t blob_total_read
int ups_bool_t
Definition: types.h:131
min_max_avg_u32_t keylist_blocks_per_page
min_max_avg_u32_t keylist_unused
UPS_EXPORT void UPS_CALLCONV ups_set_context_data(ups_db_t *db, void *data)
unsigned short uint16_t
Definition: msstdint.h:84
uint64_t freelist_hits
struct ups_env_metrics_t ups_env_metrics_t
UPS_EXPORT uint32_t UPS_CALLCONV ups_db_get_compare_name_hash(ups_db_t *db)
unsigned __int64 uint64_t
Definition: msstdint.h:95
uint64_t btree_smo_split
uint64_t mem_peak_usage
uint64_t key_bytes_before_compression
uint64_t page_count_type_blob
min_max_avg_u32_t recordlist_index
min_max_avg_u32_t recordlist_ranges
struct min_max_avg_u32_t min_max_avg_u32_t
uint16_t database_name
uint64_t blob_total_allocated
unsigned int uint32_t
Definition: msstdint.h:85
uint64_t journal_bytes_after_compression
uint64_t number_of_keys
Include file for upscaledb embedded database.
uint64_t number_of_pages
uint64_t btree_smo_merge
uint64_t mem_current_allocations
struct ups_db_t ups_db_t
Definition: upscaledb.h:154
UPS_EXPORT void *UPS_CALLCONV ups_get_context_data(ups_db_t *db, ups_bool_t dont_lock)
struct ups_cursor_t ups_cursor_t
Definition: upscaledb.h:175
min_max_avg_u32_t keylist_index
#define UPS_CALLCONV
Definition: types.h:97
btree_metrics_t btree_leaf_metrics
uint64_t freelist_misses
uint64_t mem_heap_size
uint64_t page_count_type_index
uint64_t extended_keys
UPS_EXPORT ups_bool_t UPS_CALLCONV ups_is_debug()
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_metrics(ups_env_t *env, ups_env_metrics_t *metrics)
UPS_EXPORT int UPS_CALLCONV ups_key_get_approximate_match_type(ups_key_t *key)
uint64_t page_count_flushed
uint64_t extended_duptables
uint64_t record_bytes_after_compression
uint64_t mem_total_allocations
struct btree_metrics_t btree_metrics_t
min_max_avg_u32_t keylist_ranges
#define UPS_EXPORT
Definition: types.h:89
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_check_integrity(ups_db_t *db, uint32_t flags)
int ups_status_t
Definition: types.h:138
UPS_EXPORT ups_db_t *UPS_CALLCONV ups_cursor_get_database(ups_cursor_t *cursor)
uint64_t mem_current_usage
btree_metrics_t btree_internal_metrics
min_max_avg_u32_t keylist_block_sizes
uint64_t journal_bytes_flushed
ups_bool_t is_avx_enabled
uint64_t journal_bytes_before_compression
min_max_avg_u32_t keys_per_page
uint64_t page_count_fetched
uint64_t total_btree_space
uint64_t record_bytes_before_compression
uint64_t key_bytes_after_compression
min_max_avg_u32_t recordlist_unused
uint32_t overhead_per_page
struct ups_env_t ups_env_t
Definition: upscaledb.h:163