コード例 #1
0
ファイル: DB_ENV.cs プロジェクト: yilu1021/SpaceChain-OS
        internal MempStatStruct memp_stat(uint flags)
        {
            int    err = 0;
            int    cnt = 0;
            IntPtr mpf = new IntPtr();
            IntPtr ptr = memp_stat(ref mpf, flags, ref err, ref cnt);

            DatabaseException.ThrowException(err);
            IntPtr[] files = new IntPtr[cnt];
            if (cnt > 0)
            {
                Marshal.Copy(mpf, files, 0, cnt);
            }

            MempStatStruct ret = new MempStatStruct();

            ret.st    = (MPoolStatStruct)Marshal.PtrToStructure(ptr, typeof(MPoolStatStruct));
            ret.files = new MPoolFileStatStruct[cnt];
            for (int i = 0; i < cnt; i++)
            {
                ret.files[i] = (MPoolFileStatStruct)Marshal.PtrToStructure(files[i], typeof(MPoolFileStatStruct));
            }

            libdb_csharp.__os_ufree(null, ptr);
            libdb_csharp.__os_ufree(null, mpf);
            return(ret);
        }
コード例 #2
0
ファイル: MPoolStats.cs プロジェクト: DongDongJu/kmucse
 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 <MPoolFileStats>();
     foreach (Internal.MPoolFileStatStruct file in stats.files)
     {
         mempfiles.Add(new MPoolFileStats(file));
     }
 }
コード例 #3
0
ファイル: DB_ENV.cs プロジェクト: bohrasd/windowsrtdev
        internal MempStatStruct memp_stat(uint flags)
        {
            int err = 0;
            int cnt = 0;
            IntPtr mpf = new IntPtr();
            IntPtr ptr = memp_stat(ref mpf, flags, ref err, ref cnt);
            DatabaseException.ThrowException(err);
            IntPtr[] files = new IntPtr[cnt];
            if (cnt > 0)
                Marshal.Copy(mpf, files, 0, cnt);

            MempStatStruct ret = new MempStatStruct();
            ret.st = (MPoolStatStruct)Marshal.PtrToStructure(ptr, typeof(MPoolStatStruct));
            ret.files = new MPoolFileStatStruct[cnt];
            for (int i = 0; i < cnt; i++)
                ret.files[i] = (MPoolFileStatStruct)Marshal.PtrToStructure(files[i], typeof(MPoolFileStatStruct));

            libdb_csharp.__os_ufree(null, ptr);
            libdb_csharp.__os_ufree(null, mpf);
            return ret;
        }