• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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::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 8.  The DbLsn Handle" />
11    <link rel="prev" href="envlog_set_config.html" title="DbEnv::log_set_config()" />
12    <link rel="next" href="logstat_print.html" title="DbEnv::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">DbEnv::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 8. 
23                The DbLsn 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>DbEnv::log_stat()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39
40int
41DbEnv::log_stat(DB_LOG_STAT **statp, u_int32_t flags); </pre>
42      <p>
43         The <code class="methodname">DbEnv::log_stat()</code> method returns the logging subsystem
44         statistics.
45    </p>
46      <p>
47         The <code class="methodname">DbEnv::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="DbEnv::set_alloc()">DbEnv::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">DbEnv::log_stat()</code> method may not be called before the 
259              <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>  method is called.
260    </p>
261      <p>
262         The <code class="methodname">DbEnv::log_stat()</code> <span>
263            
264            <span>
265                method either returns a non-zero error value or throws an
266                exception that encapsulates a non-zero error value on
267                failure, and returns 0 on success.
268            </span>
269        </span>
270    </p>
271      <div class="sect2" lang="en" xml:lang="en">
272        <div class="titlepage">
273          <div>
274            <div>
275              <h3 class="title"><a id="id1687173"></a>Parameters</h3>
276            </div>
277          </div>
278        </div>
279        <div class="sect3" lang="en" xml:lang="en">
280          <div class="titlepage">
281            <div>
282              <div>
283                <h4 class="title"><a id="id1687028"></a>flags</h4>
284              </div>
285            </div>
286          </div>
287          <p>
288                          The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
289                          or the following value:
290                     </p>
291          <div class="itemizedlist">
292            <ul type="disc">
293              <li>
294                <p><a id="stat_DB_STAT_CLEAR"></a>
295                        <code class="literal">DB_STAT_CLEAR</code>
296                    </p>
297                <p>
298                        Reset statistics after returning their values.
299                    </p>
300              </li>
301            </ul>
302          </div>
303        </div>
304        <div class="sect3" lang="en" xml:lang="en">
305          <div class="titlepage">
306            <div>
307              <div>
308                <h4 class="title"><a id="id1687584"></a>statp</h4>
309              </div>
310            </div>
311          </div>
312          <p>
313                          The <span class="bold"><strong>statp</strong></span> parameter references memory
314                          into which a pointer to the allocated statistics structure is copied.
315                     </p>
316        </div>
317      </div>
318      <div class="sect2" lang="en" xml:lang="en">
319        <div class="titlepage">
320          <div>
321            <div>
322              <h3 class="title"><a id="id1686879"></a>Errors</h3>
323            </div>
324          </div>
325        </div>
326        <p>
327                         The <code class="methodname">DbEnv::log_stat()</code> <span>
328            
329            <span>
330                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
331                exception, encapsulating one of the following non-zero errors, or return one
332                of the following non-zero errors:
333            </span>
334        </span>
335                    </p>
336        <div class="sect3" lang="en" xml:lang="en">
337          <div class="titlepage">
338            <div>
339              <div>
340                <h4 class="title"><a id="id1687504"></a>EINVAL</h4>
341              </div>
342            </div>
343          </div>
344          <p>
345                An invalid flag value or parameter was specified.
346            </p>
347        </div>
348      </div>
349      <div class="sect2" lang="en" xml:lang="en">
350        <div class="titlepage">
351          <div>
352            <div>
353              <h3 class="title"><a id="id1686412"></a>Class</h3>
354            </div>
355          </div>
356        </div>
357        <p>
358                    <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, 
359                    <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, 
360                    <a class="link" href="lsn.html" title="Chapter 8.  The DbLsn Handle">DbLsn</a> 
361            </p>
362      </div>
363      <div class="sect2" lang="en" xml:lang="en">
364        <div class="titlepage">
365          <div>
366            <div>
367              <h3 class="title"><a id="id1687580"></a>See Also</h3>
368            </div>
369          </div>
370        </div>
371        <p>
372                     <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 
373                </p>
374      </div>
375    </div>
376    <div class="navfooter">
377      <hr />
378      <table width="100%" summary="Navigation footer">
379        <tr>
380          <td width="40%" align="left"><a accesskey="p" href="envlog_set_config.html">Prev</a> </td>
381          <td width="20%" align="center">
382            <a accesskey="u" href="lsn.html">Up</a>
383          </td>
384          <td width="40%" align="right"> <a accesskey="n" href="logstat_print.html">Next</a></td>
385        </tr>
386        <tr>
387          <td width="40%" align="left" valign="top">DbEnv::log_set_config() </td>
388          <td width="20%" align="center">
389            <a accesskey="h" href="index.html">Home</a>
390          </td>
391          <td width="40%" align="right" valign="top"> DbEnv::log_stat_print()</td>
392        </tr>
393      </table>
394    </div>
395  </body>
396</html>
397