memp_stat.html   [plain text]


<!--$Id: memp_stat.so,v 10.72 2007/09/21 20:06:03 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbEnv::memp_stat</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DbEnv::memp_stat</b>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db_cxx.h&gt;
<p>
int
DbEnv::memp_stat(DB_MPOOL_STAT **gsp,
    DB_MPOOL_FSTAT *(*fsp)[], u_int32_t flags);
<p>
int
DbEnv::memp_stat_print(u_int32_t flags);
</pre></b>
<hr size=1 noshade>
<b>Description: DbEnv::memp_stat</b>
<p>The DbEnv::memp_stat method returns the memory pool (that is, the buffer
cache) subsystem statistics.</p>
<p>The DbEnv::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.</p>
<p>Statistical structures are stored in allocated memory.  If application-specific allocation
routines have been declared (see <a href="../api_cxx/env_set_alloc.html">DbEnv::set_alloc</a> for more
information), they are used to allocate the memory; otherwise, the
standard C library <b>malloc</b>(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.</p>
<p>If <b>gsp</b> is non-NULL, the global statistics for the cache
<b>mp</b> are copied into the memory location to which it refers.
The following DB_MPOOL_STAT fields will be filled in:</p>
<br>
<b>size_t st_gbytes;</b><ul compact><li>Gigabytes of cache (total cache size is st_gbytes + st_bytes).</ul>
<b>size_t st_bytes;</b><ul compact><li>Bytes of cache (total cache size is st_gbytes + st_bytes).</ul>
<b>u_int32_t st_ncache;</b><ul compact><li>Number of caches.</ul>
<b>u_int32_t st_max_ncache;</b><ul compact><li>Maximum number of caches, as configured with the
<a href="../api_cxx/env_set_cache_max.html">DbEnv::set_cache_max</a> method.</ul>
<b>roff_t st_regsize;</b><ul compact><li>Individual cache size, in bytes.</ul>
<b>size_t st_mmapsize;</b><ul compact><li>Maximum memory-mapped file size.</ul>
<b>int st_maxopenfd;</b><ul compact><li>Maximum open file descriptors.</ul>
<b>int st_maxwrite;</b><ul compact><li>Maximum sequential buffer writes.</ul>
<b>db_timeout_t st_maxwrite_sleep;</b><ul compact><li>Microseconds to pause after writing maximum sequential buffers.</ul>
<b>u_int32_t st_map;</b><ul compact><li>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).</ul>
<b>u_int32_t st_cache_hit;</b><ul compact><li>Requested pages found in the cache.</ul>
<b>u_int32_t st_cache_miss;</b><ul compact><li>Requested pages not found in the cache.</ul>
<b>u_int32_t st_page_create;</b><ul compact><li>Pages created in the cache.</ul>
<b>u_int32_t st_page_in;</b><ul compact><li>Pages read into the cache.</ul>
<b>u_int32_t st_page_out;</b><ul compact><li>Pages written from the cache to the backing file.</ul>
<b>u_int32_t st_ro_evict;</b><ul compact><li>Clean pages forced from the cache.</ul>
<b>u_int32_t st_rw_evict;</b><ul compact><li>Dirty pages forced from the cache.</ul>
<b>u_int32_t st_page_trickle;</b><ul compact><li>Dirty pages written using the <a href="../api_cxx/memp_trickle.html">DbEnv::memp_trickle</a> method.</ul>
<b>u_int32_t st_pages;</b><ul compact><li>Pages in the cache.</ul>
<b>u_int32_t st_page_clean;</b><ul compact><li>Clean pages currently in the cache.</ul>
<b>u_int32_t st_page_dirty;</b><ul compact><li>Dirty pages currently in the cache.</ul>
<b>u_int32_t st_hash_buckets;</b><ul compact><li>Number of hash buckets in buffer hash table.</ul>
<b>u_int32_t st_hash_searches;</b><ul compact><li>Total number of buffer hash table lookups.</ul>
<b>u_int32_t st_hash_longest;</b><ul compact><li>Longest chain ever encountered in buffer hash table lookups.</ul>
<b>u_int32_t st_hash_examined;</b><ul compact><li>Total number of hash elements traversed during hash table lookups.</ul>
<b>u_int32_t st_hash_nowait;</b><ul compact><li>Number of times that a thread of control was able to obtain a hash
bucket lock without waiting.</ul>
<b>u_int32_t st_hash_wait;</b><ul compact><li>Number of times that a thread of control was forced to wait before
obtaining a hash bucket lock.</ul>
<b>u_int32_t st_hash_max_nowait;</b><ul compact><li>The number of times a thread of control was able to obtain the hash
bucket lock without waiting on the bucket which had the maximum number
of times that a thread of control needed to wait.</ul>
<b>u_int32_t st_hash_max_wait;</b><ul compact><li>Maximum number of times any hash bucket lock was waited for by a
thread of control.</ul>
<b>u_int32_t st_region_wait;</b><ul compact><li>Number of times that a thread of control was forced to wait before
obtaining a cache region mutex.</ul>
<b>u_int32_t st_region_nowait;</b><ul compact><li>Number of times that a thread of control was able to obtain a cache
region mutex without waiting.</ul>
<b>u_int32_t st_mvcc_frozen;</b><ul compact><li>Number of buffers frozen.</ul>
<b>u_int32_t st_mvcc_thawed;</b><ul compact><li>Number of buffers thawed.</ul>
<b>u_int32_t st_mvcc_freed;</b><ul compact><li>Number of frozen buffers freed.</ul>
<b>u_int32_t st_alloc;</b><ul compact><li>Number of page allocations.</ul>
<b>u_int32_t st_alloc_buckets;</b><ul compact><li>Number of hash buckets checked during allocation.</ul>
<b>u_int32_t st_alloc_max_buckets;</b><ul compact><li>Maximum number of hash buckets checked during an allocation.</ul>
<b>u_int32_t st_alloc_pages;</b><ul compact><li>Number of pages checked during allocation.</ul>
<b>u_int32_t st_alloc_max_pages;</b><ul compact><li>Maximum number of pages checked during an allocation.</ul>
<b>u_int32_t st_io_wait;</b><ul compact><li>Number of operations blocked waiting for I/O to complete.</ul>
<br>
<p>If <b>fsp</b> is non-NULL, a pointer to a NULL-terminated
variable length array of statistics for individual files, in the cache
<b>mp</b>, is copied into the memory location to which it refers.  If
no individual files currently exist in the cache, <b>fsp</b> will be
set to NULL.</p>
<p>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:</p>
<br>
<b>char * file_name;</b><ul compact><li>The name of the file.</ul>
<b>size_t st_pagesize;</b><ul compact><li>Page size in bytes.</ul>
<b>u_int32_t st_cache_hit;</b><ul compact><li>Requested pages found in the cache.</ul>
<b>u_int32_t st_cache_miss;</b><ul compact><li>Requested pages not found in the cache.</ul>
<b>u_int32_t st_map;</b><ul compact><li>Requested pages mapped into the process' address space.</ul>
<b>u_int32_t st_page_create;</b><ul compact><li>Pages created in the cache.</ul>
<b>u_int32_t st_page_in;</b><ul compact><li>Pages read into the cache.</ul>
<b>u_int32_t st_page_out;</b><ul compact><li>Pages written from the cache to the backing file.</ul>
<br>
<p>The DbEnv::memp_stat method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p>
<p>The DbEnv::memp_stat method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
the following value:
<br>
<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after returning their values.</ul>
<br></ul>
 <b>fsp</b><ul compact><li>The <b>fsp</b> parameter references memory into which
a pointer to the allocated per-file statistics structures is copied.</ul> 
 <b>gsp</b><ul compact><li>The <b>gsp</b> parameter references memory into which
a pointer to the allocated global statistics structure is copied.</ul> 
<br>
<br><b>Errors</b>
<p>The DbEnv::memp_stat method
may fail and throw
<a href="../api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<b>Description: DbEnv::memp_stat_print</b>
<p>The DbEnv::memp_stat_print method displays the
memory pool subsystem statistical information, as described for the DbEnv::memp_stat method.
The information is printed to a specified output channel (see the
<a href="../api_cxx/env_set_msgfile.html">DbEnv::set_msgfile</a> method for more information), or passed to an
application callback function (see the <a href="../api_cxx/env_set_msgcall.html">DbEnv::set_msgcall</a> method for
more information).</p>
<p>The DbEnv::memp_stat_print method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p>
<p>The DbEnv::memp_stat_print method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one
or more of the following values:
<br>
<b><a name="DB_STAT_ALL">DB_STAT_ALL</a></b><ul compact><li>Display all available information.</ul>
<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after displaying their values.</ul>
<b><a name="DB_STAT_MEMP_HASH">DB_STAT_MEMP_HASH</a></b><ul compact><li>Display the buffers with hash chains.</ul>
<br></ul>
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/mempfile_class.html">DbMpoolFile</a>
<br><b>See Also</b>
<a href="../api_cxx/memp_list.html">Memory Pools and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>