/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2009 Oracle. All rights reserved. * */ using System; using System.Collections.Generic; using System.Text; namespace BerkeleyDB { /// /// Statistical information about the memory pool subsystem /// public class MPoolStats { private Internal.MPoolStatStruct st; private CacheInfo ci; private List mempfiles; internal MPoolStats(Internal.MempStatStruct stats) { st = stats.st; ci = new CacheInfo(st.st_gbytes, st.st_bytes, (int)st.st_max_ncache); mempfiles = new List(); foreach (Internal.MPoolFileStatStruct file in stats.files) mempfiles.Add(new MPoolFileStats(file)); } /// /// Total cache size and number of regions /// public CacheInfo CacheSettings { get { return ci; } } /// /// Maximum number of regions. /// public uint CacheRegions { get { return st.st_ncache; } } /// /// Maximum file size for mmap. /// public ulong MaxMMapSize { get { return (ulong)st.st_mmapsize.ToInt64(); } } /// /// Maximum number of open fd's. /// public int MaxOpenFileDescriptors { get { return st.st_maxopenfd; } } /// /// Maximum buffers to write. /// public int MaxBufferWrites { get { return st.st_maxwrite; } } /// /// Sleep after writing max buffers. /// public uint MaxBufferWritesSleep { get { return st.st_maxwrite_sleep; } } /// /// Total number of pages. /// public uint Pages { get { return st.st_pages; } } /// /// Pages from mapped files. /// public uint MappedPages { get { return st.st_map; } } /// /// Pages found in the cache. /// public ulong PagesInCache { get { return st.st_cache_hit; } } /// /// Pages not found in the cache. /// public ulong PagesNotInCache { get { return st.st_cache_miss; } } /// /// Pages created in the cache. /// public ulong PagesCreatedInCache { get { return st.st_page_create; } } /// /// Pages read in. /// public ulong PagesRead { get { return st.st_page_in; } } /// /// Pages written out. /// public ulong PagesWritten { get { return st.st_page_out; } } /// /// Clean pages forced from the cache. /// public ulong CleanPagesEvicted { get { return st.st_ro_evict; } } /// /// Dirty pages forced from the cache. /// public ulong DirtyPagesEvicted { get { return st.st_rw_evict; } } /// /// Pages written by memp_trickle. /// public ulong PagesTrickled { get { return st.st_page_trickle; } } /// /// Clean pages. /// public uint CleanPages { get { return st.st_page_clean; } } /// /// Dirty pages. /// public uint DirtyPages { get { return st.st_page_dirty; } } /// /// Number of hash buckets. /// public uint HashBuckets { get { return st.st_hash_buckets; } } /// /// Assumed page size. /// public uint PageSize { get { return st.st_pagesize; } } /// /// Total hash chain searches. /// public uint HashChainSearches { get { return st.st_hash_searches; } } /// /// Longest hash chain searched. /// public uint LongestHashChainSearch { get { return st.st_hash_longest; } } /// /// Total hash entries searched. /// public ulong HashEntriesSearched { get { return st.st_hash_examined; } } /// /// Hash lock granted with nowait. /// public ulong HashLockNoWait { get { return st.st_hash_nowait; } } /// /// Hash lock granted after wait. /// public ulong HashLockWait { get { return st.st_hash_wait; } } /// /// Max hash lock granted with nowait. /// public ulong MaxHashLockNoWait { get { return st.st_hash_max_nowait; } } /// /// Max hash lock granted after wait. /// public ulong MaxHashLockWait { get { return st.st_hash_max_wait; } } /// /// Region lock granted with nowait. /// public ulong RegionLockNoWait { get { return st.st_region_nowait; } } /// /// Region lock granted after wait. /// public ulong RegionLockWait { get { return st.st_region_wait; } } /// /// Buffers frozen. /// public ulong FrozenBuffers { get { return st.st_mvcc_frozen; } } /// /// Buffers thawed. /// public ulong ThawedBuffers { get { return st.st_mvcc_thawed; } } /// /// Frozen buffers freed. /// public ulong FrozenBuffersFreed { get { return st.st_mvcc_freed; } } /// /// Number of page allocations. /// public ulong PageAllocations { get { return st.st_alloc; } } /// /// Buckets checked during allocation. /// public ulong BucketsCheckedDuringAlloc { get { return st.st_alloc_buckets; } } /// /// Max checked during allocation. /// public ulong MaxBucketsCheckedDuringAlloc { get { return st.st_alloc_max_buckets; } } /// /// Pages checked during allocation. /// public ulong PagesCheckedDuringAlloc { get { return st.st_alloc_pages; } } /// /// Max checked during allocation. /// public ulong MaxPagesCheckedDuringAlloc { get { return st.st_alloc_max_pages; } } /// /// Thread waited on buffer I/O. /// public ulong BlockedOperations { get { return st.st_io_wait; } } /// /// Number of times sync interrupted. /// public ulong SyncInterrupted { get { return st.st_sync_interrupted; } } /// /// Region size. /// public ulong RegionSize { get { return (ulong)st.st_regsize.ToInt64(); } } /// /// Stats for files open in the memory pool /// public List Files { get { return mempfiles; } } } }