2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB: DbEnv::lock_stat</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
15
<h1>DbEnv::lock_stat</h1>
18
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
23
#include <db_cxx.h>
26
DbEnv::lock_stat(DB_LOCK_STAT **statp, u_int32_t flags);
29
<p>The DbEnv::lock_stat method returns the locking subsystem statistics.
30
<p>The <b>flags</b> value must be set to 0 or
33
<p><dt><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a><dd>Reset statistics after returning their values.
35
<p>The DbEnv::lock_stat method creates a statistical structure of type
36
DB_LOCK_STAT and copies a pointer to it into a user-specified memory
38
<p>Statistical structures are created in allocated memory. If application-specific allocation
39
routines have been declared (see <a href="../api_cxx/env_set_alloc.html">DbEnv::set_alloc</a> for more
40
information), they are used to allocate the memory; otherwise, the
41
library <b>malloc</b>(3) interface is used. The caller is
42
responsible for deallocating the memory. To deallocate the memory, free
43
the memory reference; references inside the returned memory need not be
45
<p>The following DB_LOCK_STAT fields will be filled in:
47
<dt>u_int32_t st_id;<dd>The last allocated locker ID.
48
<dt>u_int32_t st_cur_maxid;<dd>The current maximum unused locker ID.
49
<dt>u_int32_t st_nmodes;<dd>The number of lock modes.
50
<dt>u_int32_t st_maxlocks;<dd>The maximum number of locks possible.
51
<dt>u_int32_t st_maxlockers;<dd>The maximum number of lockers possible.
52
<dt>u_int32_t st_maxobjects;<dd>The maximum number of lock objects possible.
53
<dt>u_int32_t st_nlocks;<dd>The number of current locks.
54
<dt>u_int32_t st_maxnlocks;<dd>The maximum number of locks at any one time.
55
<dt>u_int32_t st_nlockers;<dd>The number of current lockers.
56
<dt>u_int32_t st_maxnlockers;<dd>The maximum number of lockers at any one time.
57
<dt>u_int32_t st_nobjects;<dd>The number of current lock objects.
58
<dt>u_int32_t st_maxnobjects;<dd>The maximum number of lock objects at any one time.
59
<dt>u_int32_t st_nrequests;<dd>The total number of locks requested.
60
<dt>u_int32_t st_nreleases;<dd>The total number of locks released.
61
<dt>u_int32_t st_nnowaits;<dd>The total number of lock requests failing because
62
<a href="../api_cxx/lock_vec.html#DB_LOCK_NOWAIT">DB_LOCK_NOWAIT</a> was set.
63
<dt>u_int32_t st_nconflicts;<dd>The total number of locks not immediately available due to conflicts.
64
<dt>u_int32_t st_ndeadlocks;<dd>The number of deadlocks.
65
<dt>u_int32_t st_locktimeout;<dd>Lock timeout value.
66
<dt>u_int32_t st_nlocktimeouts;<dd>The number of locks that have timed out.
67
<dt>u_int32_t st_txntimeout;<dd>Transaction timeout value.
68
<dt>u_int32_t st_ntxntimeouts;<dd>The number of transactions that have timed out. This value is also a
69
component of <b>st_ndeadlocks</b>, the total number of deadlocks
71
<dt>u_int32_t st_regsize;<dd>The size of the lock region.
72
<dt>u_int32_t st_region_wait;<dd>The number of times that a thread of control was forced to wait before
73
obtaining the region lock.
74
<dt>u_int32_t st_region_nowait;<dd>The number of times that a thread of control was able to obtain
75
the region lock without waiting.
77
<p>The DbEnv::lock_stat method either returns a non-zero error value or throws an exception that
78
encapsulates a non-zero error value on failure, and returns 0 on success.
80
<p>The DbEnv::lock_stat method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.
81
If a catastrophic error has occurred, the DbEnv::lock_stat method may fail and
82
either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a
83
<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>,
84
in which case all subsequent Berkeley DB calls will fail in the same way.
86
<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/lock_class.html">DbLock</a>
88
<a href="../api_cxx/lock_list.html">Locking Subsystem and Related Methods</a>
90
<table width="100%"><tr><td><br></td><td align=right>
91
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
93
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>