当前位置: 首页>>代码示例>>C#>>正文


C# Btree.MarkTree方法代码示例

本文整理汇总了C#中Btree.MarkTree方法的典型用法代码示例。如果您正苦于以下问题:C# Btree.MarkTree方法的具体用法?C# Btree.MarkTree怎么用?C# Btree.MarkTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Btree的用法示例。


在下文中一共展示了Btree.MarkTree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMemoryDump

        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior.
        public virtual Hashtable GetMemoryDump()
        {
            lock (this)
            {
                lock (objectCache)
                {
                    if (!opened)
                    {
                        throw new StorageError(StorageError.STORAGE_NOT_OPENED);
                    }
                    int bitmapSize = (int) (SupportClass.URShift(header.root[currIndex].size, (dbAllocationQuantumBits + 5))) + 1;
                    bool existsNotMarkedObjects;
                    long pos;
                    int i, j;

                    // mark
                    greyBitmap = new int[bitmapSize];
                    blackBitmap = new int[bitmapSize];
                    int rootOid = header.root[currIndex].rootObject;
                    //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior.
                    Hashtable map = new Hashtable();

                    if (rootOid != 0)
                    {
                        MemoryUsage indexUsage = new MemoryUsage(typeof(Index));
                        MemoryUsage fieldIndexUsage = new MemoryUsage(typeof(FieldIndex));
                        MemoryUsage classUsage = new MemoryUsage(typeof(Type));

                        MarkOid(rootOid);
                        do
                        {
                            existsNotMarkedObjects = false;
                            for (i = 0; i < bitmapSize; i++)
                            {
                                if (greyBitmap[i] != 0)
                                {
                                    existsNotMarkedObjects = true;
                                    for (j = 0; j < 32; j++)
                                    {
                                        if ((greyBitmap[i] & (1 << j)) != 0)
                                        {
                                            pos = (((long) i << 5) + j) << dbAllocationQuantumBits;
                                            greyBitmap[i] &= ~ (1 << j);
                                            blackBitmap[i] |= 1 << j;
                                            int offs = (int) pos & (Page.pageSize - 1);
                                            Page pg = pool.GetPage(pos - offs);
                                            int typeOid = ObjectHeader.GetType(pg.data, offs);
                                            int objSize = ObjectHeader.GetSize(pg.data, offs);
                                            int alignedSize = (objSize + dbAllocationQuantum - 1) & ~ (dbAllocationQuantum - 1);
                                            if (typeOid != 0)
                                            {
                                                MarkOid(typeOid);
                                                ClassDescriptor desc = FindClassDescriptor(typeOid);
                                                if (typeof(Btree).IsAssignableFrom(desc.cls))
                                                {
                                                    Btree btree = new Btree(pg.data, ObjectHeader.Sizeof + offs);
                                                    btree.AssignOid(this, 0, false);
                                                    int nPages = btree.MarkTree();
                                                    if (typeof(FieldIndex).IsAssignableFrom(desc.cls))
                                                    {
                                                        fieldIndexUsage.nInstances += 1;
                                                        fieldIndexUsage.totalSize += (long) nPages * Page.pageSize + objSize;
                                                        fieldIndexUsage.allocatedSize += (long) nPages * Page.pageSize + alignedSize;
                                                    }
                                                    else
                                                    {
                                                        indexUsage.nInstances += 1;
                                                        indexUsage.totalSize += (long) nPages * Page.pageSize + objSize;
                                                        indexUsage.allocatedSize += (long) nPages * Page.pageSize + alignedSize;
                                                    }
                                                }
                                                else
                                                {
                                                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior.
                                                    MemoryUsage usage = (MemoryUsage) map[desc.cls];
                                                    if (usage == null)
                                                    {
                                                        usage = new MemoryUsage(desc.cls);
                                                        map[desc.cls] = usage;
                                                    }
                                                    usage.nInstances += 1;
                                                    usage.totalSize += objSize;
                                                    usage.allocatedSize += alignedSize;

                                                    if (desc.hasReferences)
                                                    {
                                                        MarkObject(pool.Get(pos), ObjectHeader.Sizeof, desc);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                classUsage.nInstances += 1;
                                                classUsage.totalSize += objSize;
                                                classUsage.allocatedSize += alignedSize;
                                            }
                                            pool.Unfix(pg);
                                        }
                                    }
//.........这里部分代码省略.........
开发者ID:kjk,项目名称:tenderbase,代码行数:101,代码来源:StorageImpl.cs

示例2: Mark

        private void Mark()
        {
            int bitmapSize = (int) (SupportClass.URShift(header.root[currIndex].size, (dbAllocationQuantumBits + 5))) + 1;
            bool existsNotMarkedObjects;
            long pos;
            int i, j;

            if (listener != null)
            {
                listener.GcStarted();
            }

            greyBitmap = new int[bitmapSize];
            blackBitmap = new int[bitmapSize];
            int rootOid = header.root[currIndex].rootObject;
            if (rootOid != 0)
            {
                MarkOid(rootOid);
                do
                {
                    existsNotMarkedObjects = false;
                    for (i = 0; i < bitmapSize; i++)
                    {
                        if (greyBitmap[i] != 0)
                        {
                            existsNotMarkedObjects = true;
                            for (j = 0; j < 32; j++)
                            {
                                if ((greyBitmap[i] & (1 << j)) != 0)
                                {
                                    pos = (((long) i << 5) + j) << dbAllocationQuantumBits;
                                    greyBitmap[i] &= ~ (1 << j);
                                    blackBitmap[i] |= 1 << j;
                                    int offs = (int) pos & (Page.pageSize - 1);
                                    Page pg = pool.GetPage(pos - offs);
                                    int typeOid = ObjectHeader.GetType(pg.data, offs);
                                    if (typeOid != 0)
                                    {
                                        ClassDescriptor desc = FindClassDescriptor(typeOid);
                                        if (typeof(Btree).IsAssignableFrom(desc.cls))
                                        {
                                            Btree btree = new Btree(pg.data, ObjectHeader.Sizeof + offs);
                                            btree.AssignOid(this, 0, false);
                                            btree.MarkTree();
                                        }
                                        else if (desc.hasReferences)
                                        {
                                            MarkObject(pool.Get(pos), ObjectHeader.Sizeof, desc);
                                        }
                                    }
                                    pool.Unfix(pg);
                                }
                            }
                        }
                    }
                }
                while (existsNotMarkedObjects);
            }
        }
开发者ID:kjk,项目名称:tenderbase,代码行数:59,代码来源:StorageImpl.cs


注:本文中的Btree.MarkTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。