/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2009 Oracle. All rights reserved. * */ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using BerkeleyDB.Internal; namespace BerkeleyDB { /// /// Statistical information about the transaction subsystem /// public class TransactionStats { private TransactionStatStruct st; private LSN lastCkp; private List txns; internal TransactionStats(Internal.TxnStatStruct stats) { st = stats.st; lastCkp = new LSN(st.st_last_ckp.file, st.st_last_ckp.offset); txns = new List(); for (int i = 0; i < st.st_nactive; i++) txns.Add(new ActiveTransaction( stats.st_txnarray[i], stats.st_txngids[i], stats.st_txnnames[i])); } /// /// Number of aborted transactions /// public ulong Aborted { get { return st.st_naborts; } } /// /// Number of active transactions /// public uint Active { get { return st.st_nactive; } } /// /// Number of begun transactions /// public ulong Begun { get { return st.st_nbegins; } } /// /// Number of committed transactions /// public ulong Committed { get { return st.st_ncommits; } } /// /// LSN of the last checkpoint /// public LSN LastCheckpoint { get { return lastCkp; } } /// /// Time of last checkpoint /// public Int64 LastCheckpointTime { get { return st.st_time_ckp; } } /// /// Last transaction id given out /// public uint LastID { get { return st.st_last_txnid; } } /// /// Maximum active transactions /// public uint MaxActive { get { return st.st_maxnactive; } } /// /// Maximum snapshot transactions /// public uint MaxSnapshot { get { return st.st_maxnsnapshot; } } /// /// Maximum txns possible /// public uint MaxTransactions { get { return st.st_maxtxns; } } /// /// Region lock granted without wait. /// public ulong RegionLockNoWait { get { return st.st_region_nowait; } } /// /// Region size. /// public ulong RegionSize { get { return (ulong)st.st_regsize.ToInt64(); } } /// /// Region lock granted after wait. /// public ulong RegionLockWait { get { return st.st_region_wait; } } /// /// Number of restored transactions after recovery. /// public uint Restored { get { return st.st_nrestores; } } /// /// Number of snapshot transactions /// public uint Snapshot { get { return st.st_nsnapshot; } } /// /// List of active transactions /// public List Transactions { get { return txns; } } } }