2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB: DB_ENV->txn_stat</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
15
<h1>DB_ENV->txn_stat</h1>
18
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
26
DB_ENV->txn_stat(DB_ENV *env, DB_TXN_STAT **statp, u_int32_t flags);
29
<p>The DB_ENV->txn_stat method returns the transaction subsystem statistics.
30
<p>The <b>flags</b> value must be set to 0 or
33
<p><dt><a name="DB_STAT_CLEAR">DB_STAT_CLEAR</a><dd>Reset statistics after returning their values.
35
<p>The DB_ENV->txn_stat method creates a statistical structure of type
36
DB_TXN_STAT and copies a pointer to it into a user-specified memory
38
<p>Statistical structures are created in allocated memory. If application-specific allocation
39
routines have been declared (see <a href="../api_c/env_set_alloc.html">DB_ENV->set_alloc</a> for more
40
information), they are used to allocate the memory; otherwise, the
41
library <b>malloc</b>(3) interface is used. The caller is
42
responsible for deallocating the memory. To deallocate the memory, free
43
the memory reference; references inside the returned memory need not be
45
<p>The following DB_TXN_STAT fields will be filled in:
47
<dt><a href="../api_c/lsn_class.html">DB_LSN</a> st_last_ckp;<dd>The LSN of the last checkpoint.
48
<dt>time_t st_time_ckp;<dd>The time the last completed checkpoint finished (as the number of seconds
49
since the Epoch, returned by the IEEE/ANSI Std 1003.1 (POSIX) <b>time</b> interface).
50
<dt>u_int32_t st_last_txnid;<dd>The last transaction ID allocated.
51
<dt>u_int32_t st_maxtxns;<dd>The maximum number of active transactions possible.
52
<dt>u_int32_t st_nactive;<dd>The number of transactions that are currently active.
53
<dt>u_int32_t st_maxnactive;<dd>The maximum number of active transactions at any one time.
54
<dt>u_int32_t st_nbegins;<dd>The number of transactions that have begun.
55
<dt>u_int32_t st_naborts;<dd>The number of transactions that have aborted.
56
<dt>u_int32_t st_ncommits;<dd>The number of transactions that have committed.
57
<dt>u_int32_t st_nrestores;<dd>The number of transactions that have been restored.
58
<dt>u_int32_t st_regsize;<dd>The size of the region.
59
<dt>u_int32_t st_region_wait;<dd>The number of times that a thread of control was forced to wait before
60
obtaining the region lock.
61
<dt>u_int32_t st_region_nowait;<dd>The number of times that a thread of control was able to obtain
62
the region lock without waiting.
63
<dt>DB_TXN_ACTIVE *st_txnarray;<dd>A pointer to an array of <b>st_nactive</b> DB_TXN_ACTIVE structures,
64
describing the currently active transactions. The following fields of
65
the DB_TXN_ACTIVE structure will be filled in:
67
<p><dt>u_int32_t txnid;<dd>The transaction ID of the transaction.
68
<dt>u_int32_t parentid;<dd>The transaction ID of the parent transaction (or 0, if no parent).
69
<dt><a href="../api_c/lsn_class.html">DB_LSN</a> lsn;<dd>The current log sequence number when the transaction was begun.
72
<p>The DB_ENV->txn_stat method returns a non-zero error value on failure and 0 on success.
74
<p>The DB_ENV->txn_stat method may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
75
If a catastrophic error has occurred, the DB_ENV->txn_stat method may fail and
76
return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>,
77
in which case all subsequent Berkeley DB calls will fail in the same way.
79
<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/txn_class.html">DB_TXN</a>
81
<a href="../api_c/txn_list.html">Transaction Subsystem and Related Methods</a>
83
<table width="100%"><tr><td><br></td><td align=right>
84
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
86
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>