Beispiel #1
0
 public virtual long CollectFor(LocalObjectContainer db, int id, ISlotMap slotMap)
 {
     var bigSet = db.GetByID(id);
     db.Activate(bigSet, 1);
     var btree = (BTree) Reflection4.GetFieldValue(bigSet, "_bTree");
     return FileUsageStatsCollector.BTreeUsage(db, btree, slotMap);
 }
        public virtual long CollectFor(LocalObjectContainer db, int id, ISlotMap slotMap)
        {
            object bigSet = db.GetByID(id);

            db.Activate(bigSet, 1);
            BTree btree = (BTree)Reflection4.GetFieldValue(bigSet, "_bTree");

            return(FileUsageStatsCollector.BTreeUsage(db, btree, slotMap));
        }
		public FileUsageStatsCollector(IObjectContainer db, bool collectSlots)
		{
			MiscCollectors = new Hashtable();
			RegisterBigSetCollector();
			_db = (LocalObjectContainer)db;
			byte blockSize = _db.BlockSize();
			_blockConverter = blockSize > 1 ? (IBlockConverter)new BlockSizeBlockConverter(blockSize
				) : (IBlockConverter)new DisabledBlockConverter();
			_slots = collectSlots ? (ISlotMap)new SlotMapImpl(_db.FileLength()) : (ISlotMap)new 
				NullSlotMap();
		}
Beispiel #4
0
        public FileUsageStatsCollector(IObjectContainer db, bool collectSlots)
        {
            MiscCollectors = new Hashtable();
            RegisterBigSetCollector();
            _db = (LocalObjectContainer)db;
            byte blockSize = _db.BlockSize();

            _blockConverter = blockSize > 1 ? (IBlockConverter) new BlockSizeBlockConverter(blockSize
                                                                                            ) : (IBlockConverter) new DisabledBlockConverter();
            _slots = collectSlots ? (ISlotMap) new SlotMapImpl(_db.FileLength()) : (ISlotMap) new
                     NullSlotMap();
        }
Beispiel #5
0
 internal FileUsageStats(long fileSize, long fileHeader, long idSystem, long freespace
                         , long classMetadata, long freespaceUsage, long uuidUsage, ISlotMap slots, long
                         commitTimestampUsage)
 {
     _fileSize             = fileSize;
     _fileHeader           = fileHeader;
     _idSystem             = idSystem;
     _freespace            = freespace;
     _classMetadata        = classMetadata;
     _freespaceUsage       = freespaceUsage;
     _uuidUsage            = uuidUsage;
     _slots                = slots;
     _commitTimestampUsage = commitTimestampUsage;
 }
Beispiel #6
0
 internal FileUsageStats(long fileSize, long fileHeader, long idSystem, long freespace
     , long classMetadata, long freespaceUsage, long uuidUsage, ISlotMap slots, long
         commitTimestampUsage)
 {
     _fileSize = fileSize;
     _fileHeader = fileHeader;
     _idSystem = idSystem;
     _freespace = freespace;
     _classMetadata = classMetadata;
     _freespaceUsage = freespaceUsage;
     _uuidUsage = uuidUsage;
     _slots = slots;
     _commitTimestampUsage = commitTimestampUsage;
 }
Beispiel #7
0
        private static long BTreeUsage(Transaction transaction, IIdSystem idSystem, BTree
                                       btree, ISlotMap slotMap)
        {
            IEnumerator nodeIter = btree.AllNodeIds(transaction);

            Db4objects.Db4o.Internal.Slots.Slot btreeSlot = idSystem.CommittedSlot(btree.GetID
                                                                                       ());
            slotMap.Add(btreeSlot);
            long usage = btreeSlot.Length();

            while (nodeIter.MoveNext())
            {
                int curNodeId = ((int)nodeIter.Current);
                Db4objects.Db4o.Internal.Slots.Slot slot = idSystem.CommittedSlot(curNodeId);
                slotMap.Add(slot);
                usage += slot.Length();
            }
            return(usage);
        }
Beispiel #8
0
        private static long BTreeUsage(Transaction transaction, IIdSystem idSystem, BTree
                                       btree, ISlotMap slotMap)
        {
            var nodeIter  = btree.AllNodeIds(transaction);
            var btreeSlot = idSystem.CommittedSlot(btree.GetID
                                                       ());

            slotMap.Add(btreeSlot);
            long usage = btreeSlot.Length();

            while (nodeIter.MoveNext())
            {
                var curNodeId = ((int)nodeIter.Current);
                var slot      = idSystem.CommittedSlot(curNodeId);
                slotMap.Add(slot);
                usage += slot.Length();
            }
            return(usage);
        }
Beispiel #9
0
 internal static long BTreeUsage(LocalObjectContainer db, BTree btree, ISlotMap slotMap
                                 )
 {
     return(BTreeUsage(db.SystemTransaction(), db.IdSystem(), btree, slotMap));
 }
		private static long BTreeUsage(Transaction transaction, IIdSystem idSystem, BTree
			 btree, ISlotMap slotMap)
		{
			IEnumerator nodeIter = btree.AllNodeIds(transaction);
			Db4objects.Db4o.Internal.Slots.Slot btreeSlot = idSystem.CommittedSlot(btree.GetID
				());
			slotMap.Add(btreeSlot);
			long usage = btreeSlot.Length();
			while (nodeIter.MoveNext())
			{
				int curNodeId = ((int)nodeIter.Current);
				Db4objects.Db4o.Internal.Slots.Slot slot = idSystem.CommittedSlot(curNodeId);
				slotMap.Add(slot);
				usage += slot.Length();
			}
			return usage;
		}
		internal static long BTreeUsage(LocalObjectContainer db, BTree btree, ISlotMap slotMap
			)
		{
			return BTreeUsage(db.SystemTransaction(), db.IdSystem(), btree, slotMap);
		}
 private static long BTreeUsage(Transaction transaction, IIdSystem idSystem, BTree
     btree, ISlotMap slotMap)
 {
     var nodeIter = btree.AllNodeIds(transaction);
     var btreeSlot = idSystem.CommittedSlot(btree.GetID
         ());
     slotMap.Add(btreeSlot);
     long usage = btreeSlot.Length();
     while (nodeIter.MoveNext())
     {
         var curNodeId = ((int) nodeIter.Current);
         var slot = idSystem.CommittedSlot(curNodeId);
         slotMap.Add(slot);
         usage += slot.Length();
     }
     return usage;
 }