| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>DB_ENV->mutex_stat()</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C API Reference" /> |
| 10 | <link rel="up" href="mutex.html" title="Chapter 9. Mutex Methods" /> |
| 11 | <link rel="prev" href="mutexset_tas_spins.html" title="DB_ENV->mutex_set_tas_spins()" /> |
| 12 | <link rel="next" href="mutexstat_print.html" title="DB_ENV->mutex_stat_print()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DB_ENV->mutex_stat()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="mutexset_tas_spins.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 9. |
| 26 | Mutex Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="mutexstat_print.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="mutexstat"></a>DB_ENV->mutex_stat()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->mutex_stat(DB_ENV *env, DB_MUTEX_STAT **statp, u_int32_t flags); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DB_ENV->mutex_stat()</code> method returns the mutex subsystem |
| 47 | statistics. |
| 48 | </p> |
| 49 | <p> |
| 50 | The <code class="methodname">DB_ENV->mutex_stat()</code> method creates a statistical structure of |
| 51 | type <code class="literal">DB_MUTEX_STAT</code> and copies a pointer to it into a user-specified |
| 52 | memory location. |
| 53 | </p> |
| 54 | <p> |
| 55 | Statistical structures are stored in allocated memory. If |
| 56 | application-specific allocation routines have been declared (see |
| 57 | <a class="xref" href="envset_alloc.html" title="DB_ENV->set_alloc()">DB_ENV->set_alloc()</a> |
| 58 | for more information), they are used to allocate the memory; |
| 59 | otherwise, the standard C library <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is responsible |
| 60 | for deallocating the memory. To deallocate the memory, free the |
| 61 | memory reference; references inside the returned memory need not be |
| 62 | individually freed. |
| 63 | </p> |
| 64 | <p> |
| 65 | The following <code class="literal">DB_MUTEX_STAT</code> fields will be filled in: |
| 66 | </p> |
| 67 | <div class="itemizedlist"> |
| 68 | <ul type="disc"> |
| 69 | <li> |
| 70 | <p> |
| 71 | <span class="bold"><strong>u_int32_t st_mutex_align;</strong></span> |
| 72 | </p> |
| 73 | <p> |
| 74 | The mutex alignment, in bytes. |
| 75 | </p> |
| 76 | </li> |
| 77 | <li> |
| 78 | <p> |
| 79 | <span class="bold"><strong>int st_mutex_cnt;</strong></span> |
| 80 | </p> |
| 81 | <p> |
| 82 | The total number of mutexes configured. |
| 83 | </p> |
| 84 | </li> |
| 85 | <li> |
| 86 | <p> |
| 87 | <span class="bold"><strong>u_int32_t st_mutex_free;</strong></span> |
| 88 | </p> |
| 89 | <p> |
| 90 | The number of mutexes currently available. |
| 91 | </p> |
| 92 | </li> |
| 93 | <li> |
| 94 | <p> |
| 95 | <span class="bold"><strong>u_int32_t st_mutex_init;</strong></span> |
| 96 | </p> |
| 97 | <p> |
| 98 | The initial number of mutexes configured. |
| 99 | </p> |
| 100 | </li> |
| 101 | <li> |
| 102 | <p> |
| 103 | <span class="bold"><strong>u_int32_t st_mutex_inuse;</strong></span> |
| 104 | </p> |
| 105 | <p> |
| 106 | The number of mutexes currently in use. |
| 107 | </p> |
| 108 | </li> |
| 109 | <li> |
| 110 | <p> |
| 111 | <span class="bold"><strong>u_int32_t st_mutex_inuse_max;</strong></span> |
| 112 | </p> |
| 113 | <p> |
| 114 | The maximum number of mutexes ever in use. |
| 115 | </p> |
| 116 | </li> |
| 117 | <li> |
| 118 | <p> |
| 119 | <span class="bold"><strong>u_int32_t st_mutex_max;</strong></span> |
| 120 | </p> |
| 121 | <p> |
| 122 | The maximum number of mutexes. |
| 123 | </p> |
| 124 | </li> |
| 125 | <li> |
| 126 | <p> |
| 127 | <span class="bold"><strong>u_int32_t st_mutex_tas_spins;</strong></span> |
| 128 | </p> |
| 129 | <p> |
| 130 | The number of times test-and-set mutexes will spin without blocking. |
| 131 | </p> |
| 132 | </li> |
| 133 | <li> |
| 134 | <p> |
| 135 | <span class="bold"><strong>uintmax_t st_region_wait;</strong></span> |
| 136 | </p> |
| 137 | <p> |
| 138 | The number of times that a thread of control was forced to wait before |
| 139 | obtaining the mutex region mutex. |
| 140 | </p> |
| 141 | </li> |
| 142 | <li> |
| 143 | <p> |
| 144 | <span class="bold"><strong>uintmax_t st_region_nowait;</strong></span> |
| 145 | </p> |
| 146 | <p> |
| 147 | The number of times that a thread of control was able to obtain the |
| 148 | mutex region mutex without waiting. |
| 149 | </p> |
| 150 | </li> |
| 151 | <li> |
| 152 | <p> |
| 153 | <span class="bold"><strong>roff_t st_regmax;</strong></span> |
| 154 | </p> |
| 155 | <p> |
| 156 | The max size of the mutex region size. |
| 157 | </p> |
| 158 | </li> |
| 159 | <li> |
| 160 | <p> |
| 161 | <span class="bold"><strong>roff_t st_regsize;</strong></span> |
| 162 | </p> |
| 163 | <p> |
| 164 | The size of the mutex region, in bytes. |
| 165 | </p> |
| 166 | </li> |
| 167 | </ul> |
| 168 | </div> |
| 169 | <p> |
| 170 | The <code class="methodname">DB_ENV->mutex_stat()</code> method may not be called before the |
| 171 | <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. |
| 172 | </p> |
| 173 | <p> |
| 174 | The <code class="methodname">DB_ENV->mutex_stat()</code> <span> |
| 175 | <span> |
| 176 | method returns a non-zero error value on failure and 0 on success. |
| 177 | </span> |
| 178 | |
| 179 | </span> |
| 180 | </p> |
| 181 | <div class="sect2" lang="en" xml:lang="en"> |
| 182 | <div class="titlepage"> |
| 183 | <div> |
| 184 | <div> |
| 185 | <h3 class="title"><a id="idp53809760"></a>Parameters</h3> |
| 186 | </div> |
| 187 | </div> |
| 188 | </div> |
| 189 | <div class="sect3" lang="en" xml:lang="en"> |
| 190 | <div class="titlepage"> |
| 191 | <div> |
| 192 | <div> |
| 193 | <h4 class="title"><a id="idp53803488"></a>statp</h4> |
| 194 | </div> |
| 195 | </div> |
| 196 | </div> |
| 197 | <p> |
| 198 | The <span class="bold"><strong>statp</strong></span> parameter references memory |
| 199 | into which a pointer to the allocated statistics structure is copied. |
| 200 | </p> |
| 201 | </div> |
| 202 | <div class="sect3" lang="en" xml:lang="en"> |
| 203 | <div class="titlepage"> |
| 204 | <div> |
| 205 | <div> |
| 206 | <h4 class="title"><a id="idp53816704"></a>flags</h4> |
| 207 | </div> |
| 208 | </div> |
| 209 | </div> |
| 210 | <p> |
| 211 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 212 | or the following value: |
| 213 | </p> |
| 214 | <div class="itemizedlist"> |
| 215 | <ul type="disc"> |
| 216 | <li> |
| 217 | <p> |
| 218 | <code class="literal">DB_STAT_CLEAR</code> |
| 219 | </p> |
| 220 | <p> |
| 221 | Reset statistics after returning their values. |
| 222 | </p> |
| 223 | </li> |
| 224 | </ul> |
| 225 | </div> |
| 226 | </div> |
| 227 | </div> |
| 228 | <div class="sect2" lang="en" xml:lang="en"> |
| 229 | <div class="titlepage"> |
| 230 | <div> |
| 231 | <div> |
| 232 | <h3 class="title"><a id="idp53821784"></a>Errors</h3> |
| 233 | </div> |
| 234 | </div> |
| 235 | </div> |
| 236 | <p> |
| 237 | The <code class="methodname">DB_ENV->mutex_stat()</code> <span> |
| 238 | <span> |
| 239 | method may fail and return one of the following non-zero errors: |
| 240 | </span> |
| 241 | |
| 242 | </span> |
| 243 | </p> |
| 244 | <div class="sect3" lang="en" xml:lang="en"> |
| 245 | <div class="titlepage"> |
| 246 | <div> |
| 247 | <div> |
| 248 | <h4 class="title"><a id="idp53826336"></a>EINVAL</h4> |
| 249 | </div> |
| 250 | </div> |
| 251 | </div> |
| 252 | <p> |
| 253 | An invalid flag value or parameter was specified. |
| 254 | </p> |
| 255 | </div> |
| 256 | </div> |
| 257 | <div class="sect2" lang="en" xml:lang="en"> |
| 258 | <div class="titlepage"> |
| 259 | <div> |
| 260 | <div> |
| 261 | <h3 class="title"><a id="idp53807008"></a>Class</h3> |
| 262 | </div> |
| 263 | </div> |
| 264 | </div> |
| 265 | <p> |
| 266 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 267 | </p> |
| 268 | </div> |
| 269 | <div class="sect2" lang="en" xml:lang="en"> |
| 270 | <div class="titlepage"> |
| 271 | <div> |
| 272 | <div> |
| 273 | <h3 class="title"><a id="idp53827416"></a>See Also</h3> |
| 274 | </div> |
| 275 | </div> |
| 276 | </div> |
| 277 | <p> |
| 278 | <a class="xref" href="mutex.html#mutexlist" title="Mutex Methods">Mutex Methods</a> |
| 279 | </p> |
| 280 | </div> |
| 281 | </div> |
| 282 | <div class="navfooter"> |
| 283 | <hr /> |
| 284 | <table width="100%" summary="Navigation footer"> |
| 285 | <tr> |
| 286 | <td width="40%" align="left"><a accesskey="p" href="mutexset_tas_spins.html">Prev</a> </td> |
| 287 | <td width="20%" align="center"> |
| 288 | <a accesskey="u" href="mutex.html">Up</a> |
| 289 | </td> |
| 290 | <td width="40%" align="right"> <a accesskey="n" href="mutexstat_print.html">Next</a></td> |
| 291 | </tr> |
| 292 | <tr> |
| 293 | <td width="40%" align="left" valign="top">DB_ENV->mutex_set_tas_spins() </td> |
| 294 | <td width="20%" align="center"> |
| 295 | <a accesskey="h" href="index.html">Home</a> |
| 296 | </td> |
| 297 | <td width="40%" align="right" valign="top"> DB_ENV->mutex_stat_print()</td> |
| 298 | </tr> |
| 299 | </table> |
| 300 | </div> |
| 301 | </body> |
| 302 | </html> |