| 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->log_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="lsn.html" title="Chapter 7. The DB_LSN Handle" /> |
| 11 | <link rel="prev" href="envlog_set_config.html" title="DB_ENV->log_set_config()" /> |
| 12 | <link rel="next" href="logstat_print.html" title="DB_ENV->log_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->log_stat()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envlog_set_config.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 7. |
| 26 | The DB_LSN Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="logstat_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="logstat"></a>DB_ENV->log_stat()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->log_stat(DB_ENV *env, DB_LOG_STAT **statp, u_int32_t flags); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DB_ENV->log_stat()</code> method returns the logging subsystem |
| 47 | statistics. |
| 48 | </p> |
| 49 | <p> |
| 50 | The <code class="methodname">DB_ENV->log_stat()</code> method creates a statistical structure of type |
| 51 | <code class="literal">DB_LOG_STAT</code> and copies a pointer to it into a user-specified memory |
| 52 | 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_LOG_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_cur_file;</strong></span> |
| 72 | </p> |
| 73 | <p> |
| 74 | The current log file number. |
| 75 | </p> |
| 76 | </li> |
| 77 | <li> |
| 78 | <p> |
| 79 | <span class="bold"><strong>u_int32_t st_cur_offset;</strong></span> |
| 80 | </p> |
| 81 | <p> |
| 82 | The byte offset in the current log file. |
| 83 | </p> |
| 84 | </li> |
| 85 | <li> |
| 86 | <p> |
| 87 | <span class="bold"><strong>u_int32_t st_disk_file;</strong></span> |
| 88 | </p> |
| 89 | <p> |
| 90 | The log file number of the last record known to be on disk. |
| 91 | </p> |
| 92 | </li> |
| 93 | <li> |
| 94 | <p> |
| 95 | <span class="bold"><strong>u_int32_t st_disk_offset;</strong></span> |
| 96 | </p> |
| 97 | <p> |
| 98 | The byte offset of the last record known to be on disk. |
| 99 | </p> |
| 100 | </li> |
| 101 | <li> |
| 102 | <p> |
| 103 | <span class="bold"><strong>u_int32_t st_fileid_init;</strong></span> |
| 104 | </p> |
| 105 | <p> |
| 106 | The initial allocated file logging identifiers. |
| 107 | </p> |
| 108 | </li> |
| 109 | <li> |
| 110 | <p> |
| 111 | <span class="bold"><strong>u_int32_t st_lg_bsize;</strong></span> |
| 112 | </p> |
| 113 | <p> |
| 114 | The in-memory log record cache size. |
| 115 | </p> |
| 116 | </li> |
| 117 | <li> |
| 118 | <p> |
| 119 | <span class="bold"><strong>u_int32_t st_lg_size;</strong></span> |
| 120 | </p> |
| 121 | <p> |
| 122 | The log file size. |
| 123 | </p> |
| 124 | </li> |
| 125 | <li> |
| 126 | <p> |
| 127 | <span class="bold"><strong>u_int32_t st_magic;</strong></span> |
| 128 | </p> |
| 129 | <p> |
| 130 | The magic number that identifies a file as a log file. |
| 131 | </p> |
| 132 | </li> |
| 133 | <li> |
| 134 | <p> |
| 135 | <span class="bold"><strong>u_int32_t st_maxcommitperflush;</strong></span> |
| 136 | </p> |
| 137 | <p> |
| 138 | The maximum number of commits contained in a single log flush. |
| 139 | </p> |
| 140 | </li> |
| 141 | <li> |
| 142 | <p> |
| 143 | <span class="bold"><strong>u_int32_t st_maxnfileid;</strong></span> |
| 144 | </p> |
| 145 | <p> |
| 146 | The maximum number of file logging identifiers |
| 147 | used. |
| 148 | </p> |
| 149 | </li> |
| 150 | <li> |
| 151 | <p> |
| 152 | <span class="bold"><strong>u_int32_t st_mincommitperflush;</strong></span> |
| 153 | </p> |
| 154 | <p> |
| 155 | The minimum number of commits contained in a single log flush that |
| 156 | contained a commit. |
| 157 | </p> |
| 158 | </li> |
| 159 | <li> |
| 160 | <p> |
| 161 | <span class="bold"><strong>int st_mode;</strong></span> |
| 162 | </p> |
| 163 | <p> |
| 164 | The mode of any created log files. |
| 165 | </p> |
| 166 | </li> |
| 167 | <li> |
| 168 | <p> |
| 169 | <span class="bold"><strong>u_int32_t st_nfileid;</strong></span> |
| 170 | </p> |
| 171 | <p> |
| 172 | The current number of file logging identifiers. |
| 173 | </p> |
| 174 | </li> |
| 175 | <li> |
| 176 | <p> |
| 177 | <span class="bold"><strong>uintmax_t st_rcount;</strong></span> |
| 178 | </p> |
| 179 | <p> |
| 180 | The number of times the log has been read from disk. |
| 181 | </p> |
| 182 | </li> |
| 183 | <li> |
| 184 | <p> |
| 185 | <span class="bold"><strong>uintmax_t st_record;</strong></span> |
| 186 | </p> |
| 187 | <p> |
| 188 | The number of records written to this log. |
| 189 | </p> |
| 190 | </li> |
| 191 | <li> |
| 192 | <p> |
| 193 | <span class="bold"><strong>roff_t st_regsize;</strong></span> |
| 194 | </p> |
| 195 | <p> |
| 196 | The region size, in bytes. |
| 197 | </p> |
| 198 | </li> |
| 199 | <li> |
| 200 | <p> |
| 201 | <span class="bold"><strong>uintmax_t st_region_wait;</strong></span> |
| 202 | </p> |
| 203 | <p> |
| 204 | The number of times that a thread of control was forced to wait before |
| 205 | obtaining the log region mutex. |
| 206 | </p> |
| 207 | </li> |
| 208 | <li> |
| 209 | <p> |
| 210 | <span class="bold"><strong>uintmax_t st_region_nowait;</strong></span> |
| 211 | </p> |
| 212 | <p> |
| 213 | The number of times that a thread of control was able to obtain the |
| 214 | log region mutex without waiting. |
| 215 | </p> |
| 216 | </li> |
| 217 | <li> |
| 218 | <p> |
| 219 | <span class="bold"><strong>uintmax_t st_scount;</strong></span> |
| 220 | </p> |
| 221 | <p> |
| 222 | The number of times the log has been flushed to disk. |
| 223 | </p> |
| 224 | </li> |
| 225 | <li> |
| 226 | <p> |
| 227 | <span class="bold"><strong>u_int32_t st_version;</strong></span> |
| 228 | </p> |
| 229 | <p> |
| 230 | The version of the log file type. |
| 231 | </p> |
| 232 | </li> |
| 233 | <li> |
| 234 | <p> |
| 235 | <span class="bold"><strong>u_int32_t st_w_bytes;</strong></span> |
| 236 | </p> |
| 237 | <p> |
| 238 | The number of bytes over and above <span class="bold"><strong>st_w_mbytes</strong></span> written to this log. |
| 239 | </p> |
| 240 | </li> |
| 241 | <li> |
| 242 | <p> |
| 243 | <span class="bold"><strong>u_int32_t st_w_mbytes;</strong></span> |
| 244 | </p> |
| 245 | <p> |
| 246 | The number of megabytes written to this log. |
| 247 | </p> |
| 248 | </li> |
| 249 | <li> |
| 250 | <p> |
| 251 | <span class="bold"><strong>u_int32_t st_wc_bytes;</strong></span> |
| 252 | </p> |
| 253 | <p> |
| 254 | The number of bytes over and above <span class="bold"><strong>st_wc_mbytes</strong></span> written to this log since the last |
| 255 | checkpoint. |
| 256 | </p> |
| 257 | </li> |
| 258 | <li> |
| 259 | <p> |
| 260 | <span class="bold"><strong>u_int32_t st_wc_mbytes;</strong></span> |
| 261 | </p> |
| 262 | <p> |
| 263 | The number of megabytes written to this log since the last checkpoint. |
| 264 | </p> |
| 265 | </li> |
| 266 | <li> |
| 267 | <p> |
| 268 | <span class="bold"><strong>uintmax_t st_wcount_fill;</strong></span> |
| 269 | </p> |
| 270 | <p> |
| 271 | The number of times the log has been written to disk because the |
| 272 | in-memory log record cache filled up. |
| 273 | </p> |
| 274 | </li> |
| 275 | <li> |
| 276 | <p> |
| 277 | <span class="bold"><strong>uintmax_t st_wcount;</strong></span> |
| 278 | </p> |
| 279 | <p> |
| 280 | The number of times the log has been written to disk. |
| 281 | </p> |
| 282 | </li> |
| 283 | </ul> |
| 284 | </div> |
| 285 | <p> |
| 286 | The <code class="methodname">DB_ENV->log_stat()</code> method may not be called before the |
| 287 | <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. |
| 288 | </p> |
| 289 | <p> |
| 290 | The <code class="methodname">DB_ENV->log_stat()</code> <span> |
| 291 | <span> |
| 292 | method returns a non-zero error value on failure and 0 on success. |
| 293 | </span> |
| 294 | |
| 295 | </span> |
| 296 | </p> |
| 297 | <div class="sect2" lang="en" xml:lang="en"> |
| 298 | <div class="titlepage"> |
| 299 | <div> |
| 300 | <div> |
| 301 | <h3 class="title"><a id="idp52948200"></a>Parameters</h3> |
| 302 | </div> |
| 303 | </div> |
| 304 | </div> |
| 305 | <div class="sect3" lang="en" xml:lang="en"> |
| 306 | <div class="titlepage"> |
| 307 | <div> |
| 308 | <div> |
| 309 | <h4 class="title"><a id="idp52971176"></a>statp</h4> |
| 310 | </div> |
| 311 | </div> |
| 312 | </div> |
| 313 | <p> |
| 314 | The <span class="bold"><strong>statp</strong></span> parameter references memory |
| 315 | into which a pointer to the allocated statistics structure is copied. |
| 316 | </p> |
| 317 | </div> |
| 318 | <div class="sect3" lang="en" xml:lang="en"> |
| 319 | <div class="titlepage"> |
| 320 | <div> |
| 321 | <div> |
| 322 | <h4 class="title"><a id="idp52984192"></a>flags</h4> |
| 323 | </div> |
| 324 | </div> |
| 325 | </div> |
| 326 | <p> |
| 327 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 328 | or the following value: |
| 329 | </p> |
| 330 | <div class="itemizedlist"> |
| 331 | <ul type="disc"> |
| 332 | <li> |
| 333 | <p><a id="logstat_DB_STAT_CLEAR"></a> |
| 334 | <code class="literal">DB_STAT_CLEAR</code> |
| 335 | </p> |
| 336 | <p> |
| 337 | Reset statistics after returning their values. |
| 338 | </p> |
| 339 | </li> |
| 340 | </ul> |
| 341 | </div> |
| 342 | </div> |
| 343 | </div> |
| 344 | <div class="sect2" lang="en" xml:lang="en"> |
| 345 | <div class="titlepage"> |
| 346 | <div> |
| 347 | <div> |
| 348 | <h3 class="title"><a id="idp52997344"></a>Errors</h3> |
| 349 | </div> |
| 350 | </div> |
| 351 | </div> |
| 352 | <p> |
| 353 | The <code class="methodname">DB_ENV->log_stat()</code> <span> |
| 354 | <span> |
| 355 | method may fail and return one of the following non-zero errors: |
| 356 | </span> |
| 357 | |
| 358 | </span> |
| 359 | </p> |
| 360 | <div class="sect3" lang="en" xml:lang="en"> |
| 361 | <div class="titlepage"> |
| 362 | <div> |
| 363 | <div> |
| 364 | <h4 class="title"><a id="idp53001592"></a>EINVAL</h4> |
| 365 | </div> |
| 366 | </div> |
| 367 | </div> |
| 368 | <p> |
| 369 | An invalid flag value or parameter was specified. |
| 370 | </p> |
| 371 | </div> |
| 372 | </div> |
| 373 | <div class="sect2" lang="en" xml:lang="en"> |
| 374 | <div class="titlepage"> |
| 375 | <div> |
| 376 | <div> |
| 377 | <h3 class="title"><a id="idp53000296"></a>Class</h3> |
| 378 | </div> |
| 379 | </div> |
| 380 | </div> |
| 381 | <p> |
| 382 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>, |
| 383 | <a class="link" href="logc.html" title="The DB_LOGC Handle">DB_LOGC</a>, |
| 384 | <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> |
| 385 | </p> |
| 386 | </div> |
| 387 | <div class="sect2" lang="en" xml:lang="en"> |
| 388 | <div class="titlepage"> |
| 389 | <div> |
| 390 | <div> |
| 391 | <h3 class="title"><a id="idp53002672"></a>See Also</h3> |
| 392 | </div> |
| 393 | </div> |
| 394 | </div> |
| 395 | <p> |
| 396 | <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> |
| 397 | </p> |
| 398 | </div> |
| 399 | </div> |
| 400 | <div class="navfooter"> |
| 401 | <hr /> |
| 402 | <table width="100%" summary="Navigation footer"> |
| 403 | <tr> |
| 404 | <td width="40%" align="left"><a accesskey="p" href="envlog_set_config.html">Prev</a> </td> |
| 405 | <td width="20%" align="center"> |
| 406 | <a accesskey="u" href="lsn.html">Up</a> |
| 407 | </td> |
| 408 | <td width="40%" align="right"> <a accesskey="n" href="logstat_print.html">Next</a></td> |
| 409 | </tr> |
| 410 | <tr> |
| 411 | <td width="40%" align="left" valign="top">DB_ENV->log_set_config() </td> |
| 412 | <td width="20%" align="center"> |
| 413 | <a accesskey="h" href="index.html">Home</a> |
| 414 | </td> |
| 415 | <td width="40%" align="right" valign="top"> DB_ENV->log_stat_print()</td> |
| 416 | </tr> |
| 417 | </table> |
| 418 | </div> |
| 419 | </body> |
| 420 | </html> |