Пример #1
0
        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
 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
        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;
        }