Debian Codegraph @

docs/api_reference/C/txnstat.html

raw symbols SCIP
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-&gt;txn_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="txn.html" title="Chapter 12.  The DB_TXN Handle" />
11 <link rel="prev" href="txncheckpoint.html" title="DB_ENV-&gt;txn_checkpoint()" />
12 <link rel="next" href="txnstat_print.html" title="DB_ENV-&gt;txn_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-&gt;txn_stat()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="txncheckpoint.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 12. 
26 The DB_TXN Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="txnstat_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="txnstat"></a>DB_ENV-&gt;txn_stat()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;txn_stat(DB_ENV *env, DB_TXN_STAT **statp, u_int32_t flags); </pre>
45 <p>
46 The <code class="methodname">DB_ENV-&gt;txn_stat()</code> method returns the transaction subsystem
47 statistics.
48 </p>
49 <p>
50 The <code class="methodname">DB_ENV-&gt;txn_stat()</code> method creates a statistical structure of type
51 <code class="literal">DB_TXN_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-&gt;set_alloc()">DB_ENV-&gt;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_TXN_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_inittxns;</strong></span>
72 </p>
73 <p>
74 The initial number of transactions configured.
75 </p>
76 </li>
77 <li>
78 <p>
79 <span class="bold"><strong>DB_LSN st_last_ckp;</strong></span>
80 </p>
81 <p>
82 The LSN of the last checkpoint.
83 </p>
84 </li>
85 <li>
86 <p>
87 <span class="bold"><strong>u_int32_t st_last_txnid;</strong></span>
88 </p>
89 <p>
90 The last transaction ID allocated.
91 </p>
92 </li>
93 <li>
94 <p>
95 <span class="bold"><strong>u_int32_t st_maxnactive;</strong></span>
96 </p>
97 <p>
98 The maximum number of active transactions at any one time.
99 </p>
100 </li>
101 <li>
102 <p>
103 <span class="bold"><strong>u_int32_t st_maxnsnapshot;</strong></span>
104 </p>
105 <p>
106 The maximum number of transactions on the snapshot list at any one
107 time.
108 </p>
109 </li>
110 <li>
111 <p>
112 <span class="bold"><strong>u_int32_t st_maxtxns;</strong></span>
113 </p>
114 <p>
115 The maximum number of active transactions configured.
116 </p>
117 </li>
118 <li>
119 <p>
120 <span class="bold"><strong>uintmax_t st_naborts;</strong></span>
121 </p>
122 <p>
123 The number of transactions that have aborted.
124 </p>
125 </li>
126 <li>
127 <p>
128 <span class="bold"><strong>u_int32_t st_nactive;</strong></span>
129 </p>
130 <p>
131 The number of transactions that are currently active.
132 </p>
133 </li>
134 <li>
135 <p>
136 <span class="bold"><strong>uintmax_t st_nbegins;</strong></span>
137 </p>
138 <p>
139 The number of transactions that have begun.
140 </p>
141 </li>
142 <li>
143 <p>
144 <span class="bold"><strong>uintmax_t st_ncommits;</strong></span>
145 </p>
146 <p>
147 The number of transactions that have committed.
148 </p>
149 </li>
150 <li>
151 <p>
152 <span class="bold"><strong>u_int32_t st_nrestores;</strong></span>
153 </p>
154 <p>
155 The number of transactions that have been restored.
156 </p>
157 </li>
158 <li>
159 <p>
160 <span class="bold"><strong>u_int32_t st_nsnapshot;</strong></span>
161 </p>
162 <p>
163 The number of transactions on the snapshot list. These are
164 transactions which modified a database opened with
165 <a class="link" href="dbopen.html#dbopen_DB_MULTIVERSION">DB_MULTIVERSION</a>,
166 and which have committed or aborted, but the copies of pages they
167 created are still in the cache.
168 </p>
169 </li>
170 <li>
171 <p>
172 <span class="bold"><strong>uintmax_t st_region_nowait;</strong></span>
173 </p>
174 <p>
175 The number of times that a thread of control was able to obtain the
176 transaction region mutex without waiting.
177 </p>
178 </li>
179 <li>
180 <p>
181 <span class="bold"><strong>uintmax_t st_region_wait;</strong></span>
182 </p>
183 <p>
184 The number of times that a thread of control was forced to wait before
185 obtaining the transaction region mutex.
186 </p>
187 </li>
188 <li>
189 <p>
190 <span class="bold"><strong>roff_t st_regsize;</strong></span>
191 </p>
192 <p>
193 The region size, in bytes.
194 </p>
195 </li>
196 <li>
197 <p>
198 <span class="bold"><strong>time_t st_time_ckp;</strong></span>
199 </p>
200 <p>
201 The time the last completed checkpoint finished (as the number of
202 seconds since the Epoch, returned by the IEEE/ANSI Std 1003.1 (POSIX)
203 <span class="bold"><strong>time</strong></span> function).
204 </p>
205 </li>
206 <li>
207 <p>
208 <span class="bold"><strong>DB_TXN_ACTIVE *st_txnarray;</strong></span>
209 </p>
210 <p>
211 A pointer to an array of <span class="bold"><strong>st_nactive</strong></span>
212 DB_TXN_ACTIVE structures, describing the currently active
213 transactions. The following fields of the DB_TXN_ACTIVE structure will
214 be filled in:
215 </p>
216 <div class="itemizedlist">
217 <ul type="circle">
218 <li>
219 <p>
220 <span class="bold"><strong>u_int32_t txnid;</strong></span>
221 </p>
222 <p>
223 The transaction ID of the transaction.
224 </p>
225 </li>
226 <li>
227 <p>
228 <span class="bold"><strong>u_int32_t parentid;</strong></span>
229 </p>
230 <p>
231 The transaction ID of the parent transaction (or 0, if no parent).
232 </p>
233 </li>
234 <li>
235 <p>
236 <span class="bold"><strong>pid_t pid;</strong></span>
237 </p>
238 <p>
239 The process ID of the originator of the transaction.
240 </p>
241 </li>
242 <li>
243 <p>
244 <span class="bold"><strong>db_threadid_t tid;</strong></span>
245 </p>
246 <p>
247 The thread of control ID of the originator of the transaction.
248 </p>
249 </li>
250 <li>
251 <p>
252 <span class="bold"><strong>DB_LSN lsn;</strong></span>
253 </p>
254 <p>
255 The current log sequence number when the transaction was begun.
256 </p>
257 </li>
258 <li>
259 <p>
260 <span class="bold"><strong>DB_LSN read_lsn;</strong></span>
261 </p>
262 <p>
263 The log sequence number of reads for snapshot transactions.
264 </p>
265 </li>
266 <li>
267 <p>
268 <span class="bold"><strong>u_int32_t mvcc_ref;</strong></span>
269 </p>
270 <p>
271 The number of buffer copies created by this transaction that remain
272 in cache.
273 </p>
274 </li>
275 <li>
276 <p>
277 <span class="bold"><strong>u_int32_t priority;</strong></span>
278 </p>
279 <p>
280 This transaction's deadlock resolution priority.
281 </p>
282 </li>
283 <li>
284 <p>
285 <span class="bold"><strong>u_int32_t status;</strong></span>
286 </p>
287 <p>
288 Provides one of the following constants,
289 indicating the transaction status:
290 </p>
291 <table class="simplelist" border="0" summary="Simple list">
292 <tr>
293 <td>TXN_ABORTED</td>
294 </tr>
295 <tr>
296 <td>TXN_COMMITTED</td>
297 </tr>
298 <tr>
299 <td>TXN_NEED_ABORT</td>
300 </tr>
301 <tr>
302 <td>TXN_PREPARED</td>
303 </tr>
304 <tr>
305 <td>TXN_RUNNING</td>
306 </tr>
307 </table>
308 </li>
309 <li>
310 <p>
311 <span class="bold"><strong>u_int32_t xa_status;</strong></span>
312 </p>
313 <p>
314 Provides one of the following constants, which indicate the
315 XA status:
316 </p>
317 <table class="simplelist" border="0" summary="Simple list">
318 <tr>
319 <td>TXN_XA_ACTIVE</td>
320 </tr>
321 <tr>
322 <td>TXN_XA_DEADLOCKED</td>
323 </tr>
324 <tr>
325 <td>TXN_XA_IDLE</td>
326 </tr>
327 <tr>
328 <td>TXN_XA_PREPARED</td>
329 </tr>
330 <tr>
331 <td>TXN_XA_ROLLEDBACK</td>
332 </tr>
333 </table>
334 </li>
335 <li>
336 <p>
337 <span class="bold"><strong>u_int8_t gid[DB_GID_SIZE];</strong></span>
338 </p>
339 <p>
340 If the transaction was prepared using
341 <a class="xref" href="txnprepare.html" title="DB_TXN-&gt;prepare()">DB_TXN-&gt;prepare()</a>, then
342 <span class="bold"><strong>gid</strong></span> contains the
343 transaction's Global ID. Otherwise,
344 <span class="bold"><strong>gid's</strong></span> contents are undefined.
345 </p>
346 </li>
347 <li>
348 <p>
349 <span class="bold"><strong>char name[];</strong></span>
350 </p>
351 <p>
352 If a name was specified for the transaction, up to the first 50 bytes
353 of that name, followed by a nul termination byte.
354 </p>
355 </li>
356 </ul>
357 </div>
358 </li>
359 </ul>
360 </div>
361 <p>
362 The <code class="methodname">DB_ENV-&gt;txn_stat()</code> method may not be called before the
363 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method is called.
364 </p>
365 <p>
366 The <code class="methodname">DB_ENV-&gt;txn_stat()</code> <span>
367 <span>
368 method returns a non-zero error value on failure and 0 on success.
369 </span>
370
371 </span>
372 </p>
373 <div class="sect2" lang="en" xml:lang="en">
374 <div class="titlepage">
375 <div>
376 <div>
377 <h3 class="title"><a id="idp54897256"></a>Parameters</h3>
378 </div>
379 </div>
380 </div>
381 <div class="sect3" lang="en" xml:lang="en">
382 <div class="titlepage">
383 <div>
384 <div>
385 <h4 class="title"><a id="idp54884744"></a>statp</h4>
386 </div>
387 </div>
388 </div>
389 <p>
390 The <span class="bold"><strong>statp</strong></span> parameter references memory
391 into which a pointer to the allocated statistics structure is copied.
392 </p>
393 </div>
394 <div class="sect3" lang="en" xml:lang="en">
395 <div class="titlepage">
396 <div>
397 <div>
398 <h4 class="title"><a id="idp54905552"></a>flags</h4>
399 </div>
400 </div>
401 </div>
402 <p>
403 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
404 or the following value:
405 </p>
406 <div class="itemizedlist">
407 <ul type="disc">
408 <li>
409 <p>
410 <code class="literal">DB_STAT_CLEAR</code>
411 </p>
412 <p>
413 Reset statistics after returning their values.
414 </p>
415 </li>
416 </ul>
417 </div>
418 </div>
419 </div>
420 <div class="sect2" lang="en" xml:lang="en">
421 <div class="titlepage">
422 <div>
423 <div>
424 <h3 class="title"><a id="idp54901832"></a>Errors</h3>
425 </div>
426 </div>
427 </div>
428 <p>
429 The <code class="methodname">DB_ENV-&gt;txn_stat()</code> <span>
430 <span>
431 method may fail and return one of the following non-zero errors:
432 </span>
433
434 </span>
435 </p>
436 <div class="sect3" lang="en" xml:lang="en">
437 <div class="titlepage">
438 <div>
439 <div>
440 <h4 class="title"><a id="idp54887184"></a>EINVAL</h4>
441 </div>
442 </div>
443 </div>
444 <p>
445 An invalid flag value or parameter was specified.
446 </p>
447 </div>
448 </div>
449 <div class="sect2" lang="en" xml:lang="en">
450 <div class="titlepage">
451 <div>
452 <div>
453 <h3 class="title"><a id="idp54855816"></a>Class</h3>
454 </div>
455 </div>
456 </div>
457 <p>
458 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>, <a class="link" href="txn.html" title="Chapter 12.  The DB_TXN Handle">DB_TXN</a>
459 </p>
460 </div>
461 <div class="sect2" lang="en" xml:lang="en">
462 <div class="titlepage">
463 <div>
464 <div>
465 <h3 class="title"><a id="idp54913264"></a>See Also</h3>
466 </div>
467 </div>
468 </div>
469 <p>
470 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a>
471 </p>
472 </div>
473 </div>
474 <div class="navfooter">
475 <hr />
476 <table width="100%" summary="Navigation footer">
477 <tr>
478 <td width="40%" align="left"><a accesskey="p" href="txncheckpoint.html">Prev</a> </td>
479 <td width="20%" align="center">
480 <a accesskey="u" href="txn.html">Up</a>
481 </td>
482 <td width="40%" align="right"> <a accesskey="n" href="txnstat_print.html">Next</a></td>
483 </tr>
484 <tr>
485 <td width="40%" align="left" valign="top">DB_ENV-&gt;txn_checkpoint() </td>
486 <td width="20%" align="center">
487 <a accesskey="h" href="index.html">Home</a>
488 </td>
489 <td width="40%" align="right" valign="top"> DB_ENV-&gt;txn_stat_print()</td>
490 </tr>
491 </table>
492 </div>
493 </body>
494 </html>