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