hamsterdb_stats.h File Reference

Internal hamsterdb Embedded Storage statistics gathering and hinting functions. More...

#include <ham/hamsterdb.h>

Go to the source code of this file.

Data Structures

struct  ham_freelist_slotsize_stats_t
struct  ham_freelist_page_statistics_t
struct  ham_runtime_statistics_globdata_t
struct  ham_runtime_statistics_opdbdata_t
struct  ham_runtime_statistics_dbdata_t
struct  ham_statistics_t

Defines

#define HAM_STATISTICS_HIGH_WATER_MARK   0x7FFFFFFF
#define HAM_FREELIST_SLOT_SPREAD   (16-5+1)
#define HAM_OPERATION_STATS_FIND   0
#define HAM_OPERATION_STATS_INSERT   1
#define HAM_OPERATION_STATS_ERASE   2
#define HAM_OPERATION_STATS_MAX   3

Typedefs

typedef struct ham_statistics_t ham_statistics_t
typedef void ham_free_statistics_func_t (ham_statistics_t *self)

Functions

HAM_EXPORT ham_status_t
HAM_CALLCONV 
ham_clean_statistics_datarec (ham_statistics_t *stats)

Detailed Description

Internal hamsterdb Embedded Storage statistics gathering and hinting functions.

Author:
Ger Hobbelt, ger@hobbelt.com

Please be aware that the interfaces in this file are mostly for internal use. Unlike those in hamsterdb.h they are not stable and can be changed with every new version.

Definition in file hamsterdb_stats.h.


Define Documentation

#define HAM_FREELIST_SLOT_SPREAD   (16-5+1)

As we [can] support record sizes up to 4Gb, at least theoretically, we can express this size range as a spanning DB_CHUNKSIZE size range: 1..N, where N = log2(4Gb) - log2(DB_CHUNKSIZE). As we happen to know DB_CHUNKSIZE == 32, at least for all regular hamsterdb builds, our biggest power-of-2 for the freelist slot count ~ 32-5 = 27, where 0 represents slot size = 1 DB_CHUNKSIZE, 1 represents size of 2 DB_CHUNKSIZEs, 2 ~ 4 DB_CHUNKSIZEs, and so on.

EDIT: In order to cut down on statistics management cost due to overhead caused by having to keep up with the latest for VERY large sizes, we cut this number down to support sizes up to a maximum size of 64Kb ~ 2^16, meaning any requests for more than 64Kb/CHUNKSIZE bytes is sharing their statistics.

Definition at line 71 of file hamsterdb_stats.h.

#define HAM_STATISTICS_HIGH_WATER_MARK   0x7FFFFFFF

The upper bound value which will trigger a statistics data rescale operation to be initiated in order to prevent integer overflow in the statistics data elements.

Definition at line 52 of file hamsterdb_stats.h.


Typedef Documentation

function prototype for the hamsterdb-specified ham_statistics_t cleanup function.

See also:
HAM_PARAM_GET_STATISTICS
ham_statistics_t
ham_clean_statistics_datarec

Definition at line 45 of file hamsterdb_stats.h.

Definition at line 34 of file hamsterdb_stats.h.


Function Documentation

HAM_EXPORT ham_status_t HAM_CALLCONV ham_clean_statistics_datarec ( ham_statistics_t stats  ) 

Invoke the optional ham_statistics_t content cleanup function.

This function will check whether the ham_statistics_t free/cleanup callback has been set or not before invoking it.

Parameters:
stats A pointer to a valid ham_statistics_t data structure. 'Valid' means you must call this ham_clean_statistics_datarec() function after having called ham_env_get_parameters or ham_get_parameters with a HAM_PARAM_GET_STATISTICS ham_parameter_t entry which had this ham_statistics_t reference stats attached and before either the related ham_db_t or ham_env_t handles are closed (ham_env_close/ham_close) or deleted (ham_env_delete/ham_delete).
Returns:
HAM_SUCCESS upon success
HAM_INV_PARAMETER if the stats pointer is NULL
See also:
HAM_PARAM_GET_STATISTICS
ham_clean_statistics_datarec
ham_get_parameters
ham_env_get_parameters

Generated on Wed Apr 14 20:37:55 2010 for hamsterdb Embedded Database by  doxygen 1.6.1