DB_ENV->memp_stat

API Ref

#include <db.h>

int DB_ENV->memp_stat(DB_ENV *env, DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT *(*fsp)[], u_int32_t flags);

int DB_ENV->memp_stat_print(DB_ENV *env, u_int32_t flags);


Description: DB_ENV->memp_stat

The DB_ENV->memp_stat method returns the memory pool (that is, the buffer cache) subsystem statistics.

The DB_ENV->memp_stat method creates statistical structures of type DB_MPOOL_STAT and DB_MPOOL_FSTAT, and copy pointers to them into user-specified memory locations. The cache statistics are stored in the DB_MPOOL_STAT structure and the per-file cache statistics are stored the DB_MPOOL_FSTAT structure.

Statistical structures are stored in allocated memory. If application-specific allocation routines have been declared (see DB_ENV->set_alloc for more information), they are used to allocate the memory; otherwise, the standard C library malloc(3) is used. The caller is responsible for deallocating the memory. To deallocate the memory, free the memory reference; references inside the returned memory need not be individually freed.

If gsp is non-NULL, the global statistics for the cache mp are copied into the memory location to which it refers. The following DB_MPOOL_STAT fields will be filled in:

size_t st_gbytes;
Gigabytes of cache (total cache size is st_gbytes + st_bytes).
size_t st_bytes;
Bytes of cache (total cache size is st_gbytes + st_bytes).
u_int32_t st_ncache;
Number of caches.
roff_t st_regsize;
Individual cache size, in bytes.
u_int32_t st_map;
Requested pages mapped into the process' address space (there is no available information about whether or not this request caused disk I/O, although examining the application page fault rate may be helpful).
u_int32_t st_cache_hit;
Requested pages found in the cache.
u_int32_t st_cache_miss;
Requested pages not found in the cache.
u_int32_t st_page_create;
Pages created in the cache.
u_int32_t st_page_in;
Pages read into the cache.
u_int32_t st_page_out;
Pages written from the cache to the backing file.
u_int32_t st_ro_evict;
Clean pages forced from the cache.
u_int32_t st_rw_evict;
Dirty pages forced from the cache.
u_int32_t st_page_trickle;
Dirty pages written using the DB_ENV->memp_trickle method.
u_int32_t st_pages;
Pages in the cache.
u_int32_t st_page_clean;
Clean pages currently in the cache.
u_int32_t st_page_dirty;
Dirty pages currently in the cache.
u_int32_t st_hash_buckets;
Number of hash buckets in buffer hash table.
u_int32_t st_hash_searches;
Total number of buffer hash table lookups.
u_int32_t st_hash_longest;
The longest chain ever encountered in buffer hash table lookups.
u_int32_t st_hash_examined;
Total number of hash elements traversed during hash table lookups.
u_int32_t st_hash_nowait;
The number of times that a thread of control was able to obtain a hash bucket lock without waiting.
u_int32_t st_hash_wait;
The number of times that a thread of control was forced to wait before obtaining a hash bucket lock.
u_int32_t st_hash_max_wait;
The maximum number of times any hash bucket lock was waited for by a thread of control.
u_int32_t st_region_wait;
The number of times that a thread of control was forced to wait before obtaining a region lock.
u_int32_t st_region_nowait;
The number of times that a thread of control was able to obtain a region lock without waiting.
u_int32_t st_alloc;
Number of page allocations.
u_int32_t st_alloc_buckets;
Number of hash buckets checked during allocation.
u_int32_t st_alloc_max_buckets;
Maximum number of hash buckets checked during an allocation.
u_int32_t st_alloc_pages;
Number of pages checked during allocation.
u_int32_t st_alloc_max_pages;
Maximum number of pages checked during an allocation.
u_int32_t st_mmapsize;
Maximum memory-mapped file size.
u_int32_t st_maxopenfd;
Maximum open file descriptors.
u_int32_t st_maxwrite;
Maximum sequential buffer writes.
u_int32_t st_maxwrite_sleep;
Sleep after writing maximum sequential buffers.
The flags parameter must be set to 0 or the following value:
DB_STAT_CLEAR
Reset statistics after returning their values.

If fsp is non-NULL, a pointer to a NULL-terminated variable length array of statistics for individual files, in the cache mp, is copied into the memory location to which it refers. If no individual files currently exist in the cache, fsp will be set to NULL.

The per-file statistics are stored in structures of type DB_MPOOL_FSTAT. The following DB_MPOOL_FSTAT fields will be filled in for each file in the cache; that is, each element of the array:

char * file_name;
The name of the file.
size_t st_pagesize;
Page size in bytes.
u_int32_t st_cache_hit;
Requested pages found in the cache.
u_int32_t st_cache_miss;
Requested pages not found in the cache.
u_int32_t st_map;
Requested pages mapped into the process' address space.
u_int32_t st_page_create;
Pages created in the cache.
u_int32_t st_page_in;
Pages read into the cache.
u_int32_t st_page_out;
Pages written from the cache to the backing file.

The DB_ENV->memp_stat method returns a non-zero error value on failure and 0 on success.

Parameters

flags
The flags parameter must be set to 0 or the following value:
DB_STAT_CLEAR
Reset statistics after returning their values.
fsp
The fsp parameter references memory into which a pointer to the allocated per-file statistics structures is copied.
gsp
The gsp parameter references memory into which a pointer to the allocated global statistics structure is copied.

Errors

The DB_ENV->memp_stat method may fail and return one of the following non-zero errors:

EINVAL
An invalid flag value or parameter was specified.

Description: DB_ENV->memp_stat_print

The DB_ENV->memp_stat_print method prints diagnostic information to the output channel described by the DB_ENV->set_msgfile method.

The DB_ENV->memp_stat_print method may not be called before the DB_ENV->open method has been called.

The DB_ENV->memp_stat_print method returns a non-zero error value on failure and 0 on success.

Parameters

flags
The flags parameter must be set by bitwise inclusively OR'ing together one or more of the following values:
DB_STAT_ALL
Display all available information.
DB_STAT_MEMP_HASH
Display the buffers with hash chains.

Class

DB_ENV, DB_MPOOLFILE

See Also

Memory Pools and Related Methods

APIRef

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.