1<!--$Id: lock_stat.so,v 10.71 2008/03/21 18:20:27 ubell Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DB_ENV->lock_stat</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DB_ENV->lock_stat</b> 14</td> 15<td align=right> 16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a> 17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db.h> 23<p> 24int 25DB_ENV->lock_stat(DB_ENV *env, DB_LOCK_STAT **statp, u_int32_t flags); 26<p> 27int 28DB_ENV->lock_stat_print(DB_ENV *env, u_int32_t flags); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_ENV->lock_stat</b> 32<p>The DB_ENV->lock_stat method returns the locking subsystem statistics.</p> 33<p>The DB_ENV->lock_stat method creates a statistical structure of type 34DB_LOCK_STAT and copies a pointer to it into a user-specified memory 35location.</p> 36<p>Statistical structures are stored in allocated memory. If application-specific allocation 37routines have been declared (see <a href="../api_c/env_set_alloc.html">DB_ENV->set_alloc</a> for more 38information), they are used to allocate the memory; otherwise, the 39standard C library <b>malloc</b>(3) is used. The caller is 40responsible for deallocating the memory. To deallocate the memory, free 41the memory reference; references inside the returned memory need not be 42individually freed.</p> 43<p>The following DB_LOCK_STAT fields will be filled in:</p> 44<br> 45<b>u_int32_t st_id;</b><ul compact><li>The last allocated locker ID.</ul> 46<b>u_int32_t st_cur_maxid;</b><ul compact><li>The current maximum unused locker ID.</ul> 47<b>u_int32_t st_nmodes;</b><ul compact><li>The number of lock modes.</ul> 48<b>u_int32_t st_maxlocks;</b><ul compact><li>The maximum number of locks possible.</ul> 49<b>u_int32_t st_maxlockers;</b><ul compact><li>The maximum number of lockers possible.</ul> 50<b>u_int32_t st_maxobjects;</b><ul compact><li>The maximum number of lock objects possible.</ul> 51<b>u_int32_t st_partitions;</b><ul compact><li>The number of lock table partitions.</ul> 52<b>u_int32_t st_nlocks;</b><ul compact><li>The number of current locks.</ul> 53<b>u_int32_t st_maxnlocks;</b><ul compact><li>The maximum number of locks at any one time. Note that if there is more 54than one partition, this is the sum of the maximum across all partitions.</ul> 55<b>u_int32_t st_maxhlocks;</b><ul compact><li>The maximum number of locks in any hash bucket at any one time.</ul> 56<b>u_int32_t st_locksteals;</b><ul compact><li>The maximum number of locks stolen by for an empty partition.</ul> 57<b>u_int32_t st_maxlsteals;</b><ul compact><li>The maximum number of lock steals for any one partition.</ul> 58<b>u_int32_t st_nlockers;</b><ul compact><li>The number of current lockers.</ul> 59<b>u_int32_t st_maxnlockers;</b><ul compact><li>The maximum number of lockers at any one time.</ul> 60<b>u_int32_t st_nobjects;</b><ul compact><li>The number of current lock objects.</ul> 61<b>u_int32_t st_maxnobjects;</b><ul compact><li>The maximum number of lock objects at any one time. Note that if there is more 62than one partition this is the sum of the maximum across all partitions.</ul> 63<b>u_int32_t st_maxhobjects;</b><ul compact><li>The maximum number of objects in any hash bucket at any one time.</ul> 64<b>u_int32_t st_objectsteals;</b><ul compact><li>The maximum number of objects stolen by for an empty partition.</ul> 65<b>u_int32_t st_maxosteals;</b><ul compact><li>The maximum number of object steals for any one partition.</ul> 66<b>u_int32_t st_nrequests;</b><ul compact><li>The total number of locks requested.</ul> 67<b>u_int32_t st_nreleases;</b><ul compact><li>The total number of locks released.</ul> 68<b>u_int32_t st_nupgrade;</b><ul compact><li>The total number of locks upgraded.</ul> 69<b>u_int32_t st_ndowngrade;</b><ul compact><li>The total number of locks downgraded.</ul> 70<b>u_int32_t st_lock_wait;</b><ul compact><li>The number of lock requests not immediately available due to conflicts, 71for which the thread of control waited.</ul> 72<b>u_int32_t st_lock_nowait;</b><ul compact><li>The number of lock requests not immediately available due to conflicts, 73for which the thread of control did not wait.</ul> 74<b>u_int32_t st_ndeadlocks;</b><ul compact><li>The number of deadlocks.</ul> 75<b>u_int32_t st_locktimeout;</b><ul compact><li>Lock timeout value.</ul> 76<b>u_int32_t st_nlocktimeouts;</b><ul compact><li>The number of lock requests that have timed out.</ul> 77<b>u_int32_t st_txntimeout;</b><ul compact><li>Transaction timeout value.</ul> 78<b>u_int32_t st_ntxntimeouts;</b><ul compact><li>The number of transactions that have timed out. This value is also a 79component of <b>st_ndeadlocks</b>, the total number of deadlocks 80detected.</ul> 81<b>u_int32_t st_objs_wait;</b><ul compact><li>The number of requests to allocate or deallocate an object 82for which the thread of control waited.</ul> 83<b>u_int32_t st_objs_nowait;</b><ul compact><li>The number of requests to allocate or deallocate an object 84for which the thread of control did not wait.</ul> 85<b>u_int32_t st_lockers_wait;</b><ul compact><li>The number of requests to allocate or deallocate a locker 86for which the thread of control waited.</ul> 87<b>u_int32_t st_lockers_nowait;</b><ul compact><li>The number of requests to allocate or deallocate a locker 88for which the thread of control did not wait.</ul> 89<b>u_int32_t st_hash_len;</b><ul compact><li>Maximum length of a lock hash bucket.</ul> 90<b>roff_t st_regsize;</b><ul compact><li>The size of the lock region, in bytes.</ul> 91<b>u_int32_t st_part_wait;</b><ul compact><li>The number of times that a thread of control was forced to wait before 92obtaining the lock partition mutex.</ul> 93<b>u_int32_t st_part_nowait;</b><ul compact><li>The number of times that a thread of control was able to obtain 94the lock partition mutex without waiting.</ul> 95<b>u_int32_t st_part_max_wait;</b><ul compact><li>The maximum number of times that a thread of control was forced to wait before 96obtaining any one lock partition mutex.</ul> 97<b>u_int32_t st_part_max_nowait;</b><ul compact><li>The number of times that a thread of control was able to obtain 98any one lock partition mutex without waiting.</ul> 99<b>u_int32_t st_region_wait;</b><ul compact><li>The number of times that a thread of control was forced to wait before 100obtaining the lock region mutex.</ul> 101<b>u_int32_t st_region_nowait;</b><ul compact><li>The number of times that a thread of control was able to obtain 102the lock region mutex without waiting.</ul> 103<br> 104<p>The DB_ENV->lock_stat method may not be called before the <a href="../api_c/env_open.html">DB_ENV->open</a> method is called.</p> 105<p>The DB_ENV->lock_stat method 106returns a non-zero error value on failure 107and 0 on success. 108</p> 109<b>Parameters</b> <br> 110 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or 111the following value: 112<br> 113<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after returning their values.</ul> 114<br></ul> 115 <b>statp</b><ul compact><li>The <b>statp</b> parameter references memory into which 116a pointer to the allocated statistics structure is copied.</ul> 117<br> 118<br><b>Errors</b> 119<p>The DB_ENV->lock_stat method 120may fail and return one of the following non-zero errors:</p> 121<br> 122<b>EINVAL</b><ul compact><li>An 123invalid flag value or parameter was specified.</ul> 124<br> 125<hr size=1 noshade> 126<b>Description: DB_ENV->lock_stat_print</b> 127<p>The DB_ENV->lock_stat_print method displays the 128locking subsystem statistical information, as described for the DB_ENV->lock_stat method. 129The information is printed to a specified output channel (see the 130<a href="../api_c/env_set_msgfile.html">DB_ENV->set_msgfile</a> method for more information), or passed to an 131application callback function (see the <a href="../api_c/env_set_msgcall.html">DB_ENV->set_msgcall</a> method for 132more information).</p> 133<p>The DB_ENV->lock_stat_print method may not be called before the <a href="../api_c/env_open.html">DB_ENV->open</a> method is called.</p> 134<p>The DB_ENV->lock_stat_print method 135returns a non-zero error value on failure 136and 0 on success. 137</p> 138<b>Parameters</b> <br> 139 <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 140or more of the following values: 141<br> 142<b><a name="DB_STAT_ALL">DB_STAT_ALL</a></b><ul compact><li>Display all available information.</ul> 143<b><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a></b><ul compact><li>Reset statistics after displaying their values.</ul> 144<b><a name="DB_STAT_LOCK_CONF">DB_STAT_LOCK_CONF</a></b><ul compact><li>Display the lock conflict matrix.</ul> 145<b><a name="DB_STAT_LOCK_LOCKERS">DB_STAT_LOCK_LOCKERS</a></b><ul compact><li>Display the lockers within hash chains.</ul> 146<b><a name="DB_STAT_LOCK_OBJECTS">DB_STAT_LOCK_OBJECTS</a></b><ul compact><li>Display the lock objects within hash chains.</ul> 147<b><a name="DB_STAT_LOCK_PARAMS">DB_STAT_LOCK_PARAMS</a></b><ul compact><li>Display the locking subsystem parameters.</ul> 148<br></ul> 149<br> 150<hr size=1 noshade> 151<br><b>Class</b> 152<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/lock_class.html">DB_LOCK</a> 153<br><b>See Also</b> 154<a href="../api_c/lock_list.html">Locking Subsystem and Related Methods</a> 155</tt> 156<table width="100%"><tr><td><br></td><td align=right> 157<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 158</td></tr></table> 159<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 160</body> 161</html> 162