| 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>DbEnv::lock_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="lock.html" title="Chapter 7. The DbLock Handle" /> |
| 11 | <link rel="prev" href="lockput.html" title="DbEnv::lock_put()" /> |
| 12 | <link rel="next" href="lockstat_print.html" title="DbEnv::lock_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">DbEnv::lock_stat()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="lockput.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 7. |
| 26 | The DbLock Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="lockstat_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="lockstat"></a>DbEnv::lock_stat()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbEnv::lock_stat(DB_LOCK_STAT **statp, u_int32_t flags); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DbEnv::lock_stat()</code> method returns the locking subsystem |
| 47 | statistics. |
| 48 | </p> |
| 49 | <p> |
| 50 | The <code class="methodname">DbEnv::lock_stat()</code> method creates a statistical structure of |
| 51 | type DB_LOCK_STAT 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="DbEnv::set_alloc()">DbEnv::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 DB_LOCK_STAT 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_cur_maxid;</strong></span> |
| 72 | </p> |
| 73 | <p> |
| 74 | The current maximum unused locker ID. |
| 75 | </p> |
| 76 | </li> |
| 77 | <li> |
| 78 | <p> |
| 79 | <span class="bold"><strong>u_int32_t st_hash_len;</strong></span> |
| 80 | </p> |
| 81 | <p> |
| 82 | Maximum length of a lock hash bucket. |
| 83 | </p> |
| 84 | </li> |
| 85 | <li> |
| 86 | <p> |
| 87 | <span class="bold"><strong>u_int32_t st_id;</strong></span> |
| 88 | </p> |
| 89 | <p> |
| 90 | The last allocated locker ID. |
| 91 | </p> |
| 92 | </li> |
| 93 | <li> |
| 94 | <p> |
| 95 | <span class="bold"><strong>u_int32_t st_initlocks;</strong></span> |
| 96 | </p> |
| 97 | <p> |
| 98 | The initial number of locks allocated in the lock |
| 99 | table. |
| 100 | </p> |
| 101 | </li> |
| 102 | <li> |
| 103 | <p> |
| 104 | <span class="bold"><strong>u_int32_t st_initlockers;</strong></span> |
| 105 | </p> |
| 106 | <p> |
| 107 | The initial number of lockers allocated in the lock |
| 108 | table. |
| 109 | </p> |
| 110 | </li> |
| 111 | <li> |
| 112 | <p> |
| 113 | <span class="bold"><strong>u_int32_t st_initobjects;</strong></span> |
| 114 | </p> |
| 115 | <p> |
| 116 | The initial number of lock objects allocated in the lock |
| 117 | table. |
| 118 | </p> |
| 119 | </li> |
| 120 | <li> |
| 121 | <p> |
| 122 | <span class="bold"><strong>uintmax_t st_lock_nowait;</strong></span> |
| 123 | </p> |
| 124 | <p> |
| 125 | The number of lock requests not immediately available due to |
| 126 | conflicts, for which the thread of control did not wait. |
| 127 | </p> |
| 128 | </li> |
| 129 | <li> |
| 130 | <p> |
| 131 | <span class="bold"><strong>uintmax_t st_lock_wait;</strong></span> |
| 132 | </p> |
| 133 | <p> |
| 134 | The number of lock requests not immediately available due to |
| 135 | conflicts, for which the thread of control waited. |
| 136 | </p> |
| 137 | </li> |
| 138 | <li> |
| 139 | <p> |
| 140 | <span class="bold"><strong>uintmax_t st_lockers_nowait;</strong></span> |
| 141 | </p> |
| 142 | <p> |
| 143 | The number of requests to allocate or deallocate a locker for which |
| 144 | the thread of control did not wait. |
| 145 | </p> |
| 146 | </li> |
| 147 | <li> |
| 148 | <p> |
| 149 | <span class="bold"><strong>uintmax_t st_lockers_wait;</strong></span> |
| 150 | </p> |
| 151 | <p> |
| 152 | The number of requests to allocate or deallocate a locker for which |
| 153 | the thread of control waited. |
| 154 | </p> |
| 155 | </li> |
| 156 | <li> |
| 157 | <p> |
| 158 | <span class="bold"><strong>u_int32_t st_lockers;</strong></span> |
| 159 | </p> |
| 160 | <p> |
| 161 | The current number of lockers allocated in the lock table. |
| 162 | </p> |
| 163 | </li> |
| 164 | <li> |
| 165 | <p> |
| 166 | <span class="bold"><strong>u_int32_t st_locks;</strong></span> |
| 167 | </p> |
| 168 | <p> |
| 169 | The current number of locks allocated in the lock table. |
| 170 | </p> |
| 171 | </li> |
| 172 | <li> |
| 173 | <p> |
| 174 | <span class="bold"><strong>uintmax_t st_locksteals;</strong></span> |
| 175 | </p> |
| 176 | <p> |
| 177 | The maximum number of locks stolen by an empty partition. |
| 178 | </p> |
| 179 | </li> |
| 180 | <li> |
| 181 | <p> |
| 182 | <span class="bold"><strong>db_timeout_t st_locktimeout;</strong></span> |
| 183 | </p> |
| 184 | <p> |
| 185 | Lock timeout value. |
| 186 | </p> |
| 187 | </li> |
| 188 | <li> |
| 189 | <p> |
| 190 | <span class="bold"><strong>u_int32_t st_maxhlocks;</strong></span> |
| 191 | </p> |
| 192 | <p> |
| 193 | The maximum number of locks in any hash bucket at any one time. |
| 194 | </p> |
| 195 | </li> |
| 196 | <li> |
| 197 | <p> |
| 198 | <span class="bold"><strong>u_int32_t st_maxhobjects;</strong></span> |
| 199 | </p> |
| 200 | <p> |
| 201 | The maximum number of objects in any hash bucket at any one time. |
| 202 | </p> |
| 203 | </li> |
| 204 | <li> |
| 205 | <p> |
| 206 | <span class="bold"><strong>u_int32_t st_maxlockers;</strong></span> |
| 207 | </p> |
| 208 | <p> |
| 209 | The maximum number of lockers possible. |
| 210 | </p> |
| 211 | </li> |
| 212 | <li> |
| 213 | <p> |
| 214 | <span class="bold"><strong>u_int32_t st_maxlocks;</strong></span> |
| 215 | </p> |
| 216 | <p> |
| 217 | The maximum number of locks possible. |
| 218 | </p> |
| 219 | </li> |
| 220 | <li> |
| 221 | <p> |
| 222 | <span class="bold"><strong>uintmax_t st_maxlsteals;</strong></span> |
| 223 | </p> |
| 224 | <p> |
| 225 | The maximum number of lock steals for any one partition. |
| 226 | </p> |
| 227 | </li> |
| 228 | <li> |
| 229 | <p> |
| 230 | <span class="bold"><strong>u_int32_t st_maxnlockers;</strong></span> |
| 231 | </p> |
| 232 | <p> |
| 233 | The maximum number of lockers at any one time. |
| 234 | </p> |
| 235 | </li> |
| 236 | <li> |
| 237 | <p> |
| 238 | <span class="bold"><strong>u_int32_t st_maxnobjects;</strong></span> |
| 239 | </p> |
| 240 | <p> |
| 241 | The maximum number of lock objects at any one time. Note that if there |
| 242 | is more than one partition this is the sum of the maximum across all |
| 243 | partitions. |
| 244 | </p> |
| 245 | </li> |
| 246 | <li> |
| 247 | <p> |
| 248 | <span class="bold"><strong>u_int32_t st_maxnlocks;</strong></span> |
| 249 | </p> |
| 250 | <p> |
| 251 | The maximum number of locks at any one time. Note that if there is |
| 252 | more than one partition, this is the sum of the maximum across all |
| 253 | partitions. |
| 254 | </p> |
| 255 | </li> |
| 256 | <li> |
| 257 | <p> |
| 258 | <span class="bold"><strong>u_int32_t st_maxobjects;</strong></span> |
| 259 | </p> |
| 260 | <p> |
| 261 | The maximum number of lock objects possible. |
| 262 | </p> |
| 263 | </li> |
| 264 | <li> |
| 265 | <p> |
| 266 | <span class="bold"><strong>uintmax_t st_maxosteals;</strong></span> |
| 267 | </p> |
| 268 | <p> |
| 269 | The maximum number of object steals for any one partition. |
| 270 | </p> |
| 271 | </li> |
| 272 | <li> |
| 273 | <p> |
| 274 | <span class="bold"><strong>uintmax_t st_ndeadlocks;</strong></span> |
| 275 | </p> |
| 276 | <p> |
| 277 | The number of deadlocks. |
| 278 | </p> |
| 279 | </li> |
| 280 | <li> |
| 281 | <p> |
| 282 | <span class="bold"><strong>uintmax_t st_ndowngrade;</strong></span> |
| 283 | </p> |
| 284 | <p> |
| 285 | The total number of locks downgraded. |
| 286 | </p> |
| 287 | </li> |
| 288 | <li> |
| 289 | <p> |
| 290 | <span class="bold"><strong>u_int32_t st_nlockers;</strong></span> |
| 291 | </p> |
| 292 | <p> |
| 293 | The number of current lockers. |
| 294 | </p> |
| 295 | </li> |
| 296 | <li> |
| 297 | <p> |
| 298 | <span class="bold"><strong>u_int32_t st_nlocks;</strong></span> |
| 299 | </p> |
| 300 | <p> |
| 301 | The number of current locks. |
| 302 | </p> |
| 303 | </li> |
| 304 | <li> |
| 305 | <p> |
| 306 | <span class="bold"><strong>uintmax_t st_nlocktimeouts;</strong></span> |
| 307 | </p> |
| 308 | <p> |
| 309 | The number of lock requests that have timed out. |
| 310 | </p> |
| 311 | </li> |
| 312 | <li> |
| 313 | <p> |
| 314 | <span class="bold"><strong>int st_nmodes;</strong></span> |
| 315 | </p> |
| 316 | <p> |
| 317 | The number of lock modes. |
| 318 | </p> |
| 319 | </li> |
| 320 | <li> |
| 321 | <p> |
| 322 | <span class="bold"><strong>u_int32_t st_nobjects;</strong></span> |
| 323 | </p> |
| 324 | <p> |
| 325 | The number of current lock objects. |
| 326 | </p> |
| 327 | </li> |
| 328 | <li> |
| 329 | <p> |
| 330 | <span class="bold"><strong>uintmax_t st_nreleases;</strong></span> |
| 331 | </p> |
| 332 | <p> |
| 333 | The total number of locks released. |
| 334 | </p> |
| 335 | </li> |
| 336 | <li> |
| 337 | <p> |
| 338 | <span class="bold"><strong>uintmax_t st_nrequests;</strong></span> |
| 339 | </p> |
| 340 | <p> |
| 341 | The total number of locks requested. |
| 342 | </p> |
| 343 | </li> |
| 344 | <li> |
| 345 | <p> |
| 346 | <span class="bold"><strong>uintmax_t st_ntxntimeouts;</strong></span> |
| 347 | </p> |
| 348 | <p> |
| 349 | The number of transactions that have timed out. This value is also a |
| 350 | component of <span class="bold"><strong>st_ndeadlocks</strong></span>, the total |
| 351 | number of deadlocks detected. |
| 352 | </p> |
| 353 | </li> |
| 354 | <li> |
| 355 | <p> |
| 356 | <span class="bold"><strong>uintmax_t st_nupgrade;</strong></span> |
| 357 | </p> |
| 358 | <p> |
| 359 | The total number of locks upgraded. |
| 360 | </p> |
| 361 | </li> |
| 362 | <li> |
| 363 | <p> |
| 364 | <span class="bold"><strong>u_int32_t st_objects;</strong></span> |
| 365 | </p> |
| 366 | <p> |
| 367 | The current number of lock objects allocated in the lock |
| 368 | table. |
| 369 | </p> |
| 370 | </li> |
| 371 | <li> |
| 372 | <p> |
| 373 | <span class="bold"><strong>uintmax_t st_objectsteals;</strong></span> |
| 374 | </p> |
| 375 | <p> |
| 376 | The maximum number of objects stolen by an empty partition. |
| 377 | </p> |
| 378 | </li> |
| 379 | <li> |
| 380 | <p> |
| 381 | <span class="bold"><strong>uintmax_t st_objs_nowait;</strong></span> |
| 382 | </p> |
| 383 | <p> |
| 384 | The number of requests to allocate or deallocate an object for which |
| 385 | the thread of control did not wait. |
| 386 | </p> |
| 387 | </li> |
| 388 | <li> |
| 389 | <p> |
| 390 | <span class="bold"><strong>uintmax_t st_objs_wait;</strong></span> |
| 391 | </p> |
| 392 | <p> |
| 393 | The number of requests to allocate or deallocate an object for which |
| 394 | the thread of control waited. |
| 395 | </p> |
| 396 | </li> |
| 397 | <li> |
| 398 | <p> |
| 399 | <span class="bold"><strong>uintmax_t st_part_max_nowait;</strong></span> |
| 400 | </p> |
| 401 | <p> |
| 402 | The number of times that a thread of control was able to obtain any |
| 403 | one lock partition mutex without waiting. |
| 404 | </p> |
| 405 | </li> |
| 406 | <li> |
| 407 | <p> |
| 408 | <span class="bold"><strong>uintmax_t st_part_max_wait;</strong></span> |
| 409 | </p> |
| 410 | <p> |
| 411 | The maximum number of times that a thread of control was forced to |
| 412 | wait before obtaining any one lock partition mutex. |
| 413 | </p> |
| 414 | </li> |
| 415 | <li> |
| 416 | <p> |
| 417 | <span class="bold"><strong>uintmax_t st_part_nowait;</strong></span> |
| 418 | </p> |
| 419 | <p> |
| 420 | The number of times that a thread of control was able to obtain the |
| 421 | lock partition mutex without waiting. |
| 422 | </p> |
| 423 | </li> |
| 424 | <li> |
| 425 | <p> |
| 426 | <span class="bold"><strong>uintmax_t st_part_wait;</strong></span> |
| 427 | </p> |
| 428 | <p> |
| 429 | The number of times that a thread of control was forced to wait before |
| 430 | obtaining the lock partition mutex. |
| 431 | </p> |
| 432 | </li> |
| 433 | <li> |
| 434 | <p> |
| 435 | <span class="bold"><strong>u_int32_t st_partitions;</strong></span> |
| 436 | </p> |
| 437 | <p> |
| 438 | The number of lock table partitions. |
| 439 | </p> |
| 440 | </li> |
| 441 | <li> |
| 442 | <p> |
| 443 | <span class="bold"><strong>uintmax_t st_region_nowait;</strong></span> |
| 444 | </p> |
| 445 | <p> |
| 446 | The number of times that a thread of control was able to obtain the |
| 447 | lock region mutex without waiting. |
| 448 | </p> |
| 449 | </li> |
| 450 | <li> |
| 451 | <p> |
| 452 | <span class="bold"><strong>uintmax_t st_region_wait;</strong></span> |
| 453 | </p> |
| 454 | <p> |
| 455 | The number of times that a thread of control was forced to wait before |
| 456 | obtaining the lock region mutex. |
| 457 | </p> |
| 458 | </li> |
| 459 | <li> |
| 460 | <p> |
| 461 | <span class="bold"><strong>roff_t st_regsize;</strong></span> |
| 462 | </p> |
| 463 | <p> |
| 464 | The region size, in bytes. |
| 465 | </p> |
| 466 | </li> |
| 467 | <li> |
| 468 | <p> |
| 469 | <span class="bold"><strong>u_int32_t st_tablesize;</strong></span> |
| 470 | </p> |
| 471 | <p> |
| 472 | The size of the object hash table. |
| 473 | </p> |
| 474 | </li> |
| 475 | <li> |
| 476 | <p> |
| 477 | <span class="bold"><strong>db_timeout_t st_txntimeout;</strong></span> |
| 478 | </p> |
| 479 | <p> |
| 480 | Transaction timeout value. |
| 481 | </p> |
| 482 | </li> |
| 483 | </ul> |
| 484 | </div> |
| 485 | <p> |
| 486 | The <code class="methodname">DbEnv::lock_stat()</code> method may not be called before the |
| 487 | <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called. |
| 488 | </p> |
| 489 | <p> |
| 490 | The <code class="methodname">DbEnv::lock_stat()</code> method returns a non-zero error value on |
| 491 | failure and 0 on success. |
| 492 | </p> |
| 493 | <div class="sect2" lang="en" xml:lang="en"> |
| 494 | <div class="titlepage"> |
| 495 | <div> |
| 496 | <div> |
| 497 | <h3 class="title"><a id="idp8109680"></a>Parameters</h3> |
| 498 | </div> |
| 499 | </div> |
| 500 | </div> |
| 501 | <div class="sect3" lang="en" xml:lang="en"> |
| 502 | <div class="titlepage"> |
| 503 | <div> |
| 504 | <div> |
| 505 | <h4 class="title"><a id="idp8109528"></a>statp</h4> |
| 506 | </div> |
| 507 | </div> |
| 508 | </div> |
| 509 | <p> |
| 510 | The <span class="bold"><strong>statp</strong></span> parameter references memory |
| 511 | into which a pointer to the allocated statistics structure is copied. |
| 512 | </p> |
| 513 | </div> |
| 514 | <div class="sect3" lang="en" xml:lang="en"> |
| 515 | <div class="titlepage"> |
| 516 | <div> |
| 517 | <div> |
| 518 | <h4 class="title"><a id="idp8153976"></a>flags</h4> |
| 519 | </div> |
| 520 | </div> |
| 521 | </div> |
| 522 | <p> |
| 523 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 524 | or the following value: |
| 525 | </p> |
| 526 | <div class="itemizedlist"> |
| 527 | <ul type="disc"> |
| 528 | <li> |
| 529 | <p><a id="stat_DB_STAT_CLEAR"></a> |
| 530 | <code class="literal">DB_STAT_CLEAR</code> |
| 531 | </p> |
| 532 | <p> |
| 533 | Reset statistics after returning their values. |
| 534 | </p> |
| 535 | </li> |
| 536 | </ul> |
| 537 | </div> |
| 538 | </div> |
| 539 | </div> |
| 540 | <div class="sect2" lang="en" xml:lang="en"> |
| 541 | <div class="titlepage"> |
| 542 | <div> |
| 543 | <div> |
| 544 | <h3 class="title"><a id="idp8158904"></a>Errors</h3> |
| 545 | </div> |
| 546 | </div> |
| 547 | </div> |
| 548 | <p> |
| 549 | The <code class="methodname">DbEnv::lock_stat()</code> <span> |
| 550 | |
| 551 | <span> |
| 552 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 553 | exception, encapsulating one of the following non-zero errors, or return one |
| 554 | of the following non-zero errors: |
| 555 | </span> |
| 556 | </span> |
| 557 | </p> |
| 558 | <div class="sect3" lang="en" xml:lang="en"> |
| 559 | <div class="titlepage"> |
| 560 | <div> |
| 561 | <div> |
| 562 | <h4 class="title"><a id="idp8166216"></a>EINVAL</h4> |
| 563 | </div> |
| 564 | </div> |
| 565 | </div> |
| 566 | <p> |
| 567 | An invalid flag value or parameter was specified. |
| 568 | </p> |
| 569 | </div> |
| 570 | </div> |
| 571 | <div class="sect2" lang="en" xml:lang="en"> |
| 572 | <div class="titlepage"> |
| 573 | <div> |
| 574 | <div> |
| 575 | <h3 class="title"><a id="idp8164920"></a>Class</h3> |
| 576 | </div> |
| 577 | </div> |
| 578 | </div> |
| 579 | <p> |
| 580 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, |
| 581 | <a class="link" href="lock.html" title="Chapter 7. The DbLock Handle">DbLock</a> |
| 582 | </p> |
| 583 | </div> |
| 584 | <div class="sect2" lang="en" xml:lang="en"> |
| 585 | <div class="titlepage"> |
| 586 | <div> |
| 587 | <div> |
| 588 | <h3 class="title"><a id="idp8167512"></a>See Also</h3> |
| 589 | </div> |
| 590 | </div> |
| 591 | </div> |
| 592 | <p> |
| 593 | <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a> |
| 594 | </p> |
| 595 | </div> |
| 596 | </div> |
| 597 | <div class="navfooter"> |
| 598 | <hr /> |
| 599 | <table width="100%" summary="Navigation footer"> |
| 600 | <tr> |
| 601 | <td width="40%" align="left"><a accesskey="p" href="lockput.html">Prev</a> </td> |
| 602 | <td width="20%" align="center"> |
| 603 | <a accesskey="u" href="lock.html">Up</a> |
| 604 | </td> |
| 605 | <td width="40%" align="right"> <a accesskey="n" href="lockstat_print.html">Next</a></td> |
| 606 | </tr> |
| 607 | <tr> |
| 608 | <td width="40%" align="left" valign="top">DbEnv::lock_put() </td> |
| 609 | <td width="20%" align="center"> |
| 610 | <a accesskey="h" href="index.html">Home</a> |
| 611 | </td> |
| 612 | <td width="40%" align="right" valign="top"> DbEnv::lock_stat_print()</td> |
| 613 | </tr> |
| 614 | </table> |
| 615 | </div> |
| 616 | </body> |
| 617 | </html> |