1/*- 2 * Automatically built by dist/s_java_stat. 3 * Only the javadoc comments can be edited. 4 * 5 * See the file LICENSE for redistribution information. 6 * 7 * Copyright (c) 2002,2008 Oracle. All rights reserved. 8 */ 9 10package com.sleepycat.db; 11 12import com.sleepycat.db.internal.DbUtil; 13 14/** 15Transaction statistics for a database environment. 16*/ 17public class TransactionStats { 18 // no public constructor 19 /* package */ TransactionStats() {} 20 21 public static class Active { 22 // no public constructor 23 /* package */ Active() {} 24 25 private int txnid; 26 /** 27 The transaction ID of the transaction. 28 */ 29 public int getTxnId() { 30 return txnid; 31 } 32 33 private int parentid; 34 /** 35 The transaction ID of the parent transaction (or 0, if no parent). 36 */ 37 public int getParentId() { 38 return parentid; 39 } 40 41 private int pid; 42 /** The process ID of the process that owns the transaction. **/ 43 public int getPid() { 44 return pid; 45 } 46 47 private LogSequenceNumber lsn; 48 /** 49 The log sequence number of the transaction's first log record. 50 */ 51 public LogSequenceNumber getLsn() { 52 return lsn; 53 } 54 55 private LogSequenceNumber read_lsn; 56 /** 57 The log sequence number of reads for snapshot transactions. 58 */ 59 public LogSequenceNumber getReadLsn() { 60 return read_lsn; 61 } 62 63 private int mvcc_ref; 64 /** 65 The number of buffer copies created by this transaction that remain in 66 cache. 67 */ 68 public int getMultiversionRef() { 69 return mvcc_ref; 70 } 71 72 private int status; 73 /** 74 The status of the transaction. 75 */ 76 public int getStatus() { 77 return status; 78 } 79 80 private int xa_status; 81 /** 82 If the transaction is an XA transaction, the status of the 83 transaction, otherwise 0. 84 */ 85 public int getXaStatus() { 86 return xa_status; 87 } 88 89 private byte[] xid; 90 public byte[] getXId() { 91 return xid; 92 } 93 94 private String name; 95 /** 96 The transaction name, including the thread name if available. 97 */ 98 public String getName() { 99 return name; 100 } 101 102 /** {@inheritDoc} */ 103 public String toString() { 104 return "Active:" 105 + "\n txnid=" + txnid 106 + "\n parentid=" + parentid 107 + "\n pid=" + pid 108 + "\n lsn=" + lsn 109 + "\n read_lsn=" + read_lsn 110 + "\n mvcc_ref=" + mvcc_ref 111 + "\n status=" + status 112 + "\n xa_status=" + xa_status 113 + "\n xid=" + DbUtil.byteArrayToString(xid) 114 + "\n name=" + name 115 ; 116 } 117 }; 118 119 private int st_nrestores; 120 /** 121 The number of transactions that have been restored. 122 */ 123 public int getNumRestores() { 124 return st_nrestores; 125 } 126 127 private LogSequenceNumber st_last_ckp; 128 /** 129 The LSN of the last checkpoint. 130 */ 131 public LogSequenceNumber getLastCkp() { 132 return st_last_ckp; 133 } 134 135 private long st_time_ckp; 136 /** 137 The time the last completed checkpoint finished (as the number of 138 seconds since the Epoch, returned by the IEEE/ANSI Std 1003.1 139 (POSIX) time interface). 140 */ 141 public long getTimeCkp() { 142 return st_time_ckp; 143 } 144 145 private int st_last_txnid; 146 /** 147 The last transaction ID allocated. 148 */ 149 public int getLastTxnId() { 150 return st_last_txnid; 151 } 152 153 private int st_maxtxns; 154 /** 155 The maximum number of active transactions configured. 156 */ 157 public int getMaxTxns() { 158 return st_maxtxns; 159 } 160 161 private int st_naborts; 162 /** 163 The number of transactions that have aborted. 164 */ 165 public int getNaborts() { 166 return st_naborts; 167 } 168 169 private int st_nbegins; 170 /** 171 The number of transactions that have begun. 172 */ 173 public int getNumBegins() { 174 return st_nbegins; 175 } 176 177 private int st_ncommits; 178 /** 179 The number of transactions that have committed. 180 */ 181 public int getNumCommits() { 182 return st_ncommits; 183 } 184 185 private int st_nactive; 186 /** 187 The number of transactions that are currently active. 188 */ 189 public int getNactive() { 190 return st_nactive; 191 } 192 193 private int st_nsnapshot; 194 /** 195 The number of transactions on the snapshot list. These are transactions 196 which modified a database opened with {@link 197 DatabaseConfig#setMultiversion}, and which have committed or aborted, but 198 the copies of pages they created are still in the cache. 199 */ 200 public int getNumSnapshot() { 201 return st_nsnapshot; 202 } 203 204 private int st_maxnactive; 205 /** 206 The maximum number of active transactions at any one time. 207 */ 208 public int getMaxNactive() { 209 return st_maxnactive; 210 } 211 212 private int st_maxnsnapshot; 213 /** 214 The maximum number of transactions on the snapshot list at any one time. 215 */ 216 public int getMaxNsnapshot() { 217 return st_maxnsnapshot; 218 } 219 220 private Active[] st_txnarray; 221 public Active[] getTxnarray() { 222 return st_txnarray; 223 } 224 225 private int st_region_wait; 226 /** 227 The number of times that a thread of control was forced to wait 228 before obtaining the region lock. 229 */ 230 public int getRegionWait() { 231 return st_region_wait; 232 } 233 234 private int st_region_nowait; 235 /** 236 The number of times that a thread of control was able to obtain the 237 region lock without waiting. 238 */ 239 public int getRegionNowait() { 240 return st_region_nowait; 241 } 242 243 private int st_regsize; 244 /** 245 The size of the region. 246 */ 247 public int getRegSize() { 248 return st_regsize; 249 } 250 251 /** {@inheritDoc} */ 252 public String toString() { 253 return "TransactionStats:" 254 + "\n st_nrestores=" + st_nrestores 255 + "\n st_last_ckp=" + st_last_ckp 256 + "\n st_time_ckp=" + st_time_ckp 257 + "\n st_last_txnid=" + st_last_txnid 258 + "\n st_maxtxns=" + st_maxtxns 259 + "\n st_naborts=" + st_naborts 260 + "\n st_nbegins=" + st_nbegins 261 + "\n st_ncommits=" + st_ncommits 262 + "\n st_nactive=" + st_nactive 263 + "\n st_nsnapshot=" + st_nsnapshot 264 + "\n st_maxnactive=" + st_maxnactive 265 + "\n st_maxnsnapshot=" + st_maxnsnapshot 266 + "\n st_txnarray=" + DbUtil.objectArrayToString(st_txnarray, "st_txnarray") 267 + "\n st_region_wait=" + st_region_wait 268 + "\n st_region_nowait=" + st_region_nowait 269 + "\n st_regsize=" + st_regsize 270 ; 271 } 272} 273