public List <ListsInfo> GetListsStatsVerySlowly()
        {
            string           currentName      = null;
            List <ListsInfo> res              = new List <ListsInfo>();
            ListsInfo        currentListsInfo = null;
            var listsByName = tableStorage.Lists.GetIndex(Tables.Lists.Indices.ByName);

            using (var iterator = listsByName.Iterate(Snapshot, writeBatch.Value))
            {
                if (!iterator.Seek(Slice.BeforeAllKeys))
                {
                    return(res);
                }
                do
                {
                    currentListsInfo = new ListsInfo()
                    {
                        Name = iterator.CurrentKey.ToString()
                    };
                    using (var internalIterator = listsByName.MultiRead(Snapshot, iterator.CurrentKey))
                    {
                        if (!internalIterator.Seek(Slice.BeforeAllKeys))
                        {
                            continue;
                        }
                        do
                        {
                            var sizeOnDisk = iterator.GetCurrentDataSize();
                            currentListsInfo.Count++;
                            currentListsInfo.SizeOnDiskInBytes += sizeOnDisk;
                            if (sizeOnDisk > currentListsInfo.MaxListItemSizeOnDiskInBytes)
                            {
                                currentListsInfo.MaxListItemSizeOnDiskInBytes = sizeOnDisk;
                            }
                            if (currentListsInfo.MinListItemSizeOnDiskInBytes == 0 || sizeOnDisk < currentListsInfo.MinListItemSizeOnDiskInBytes)
                            {
                                currentListsInfo.MinListItemSizeOnDiskInBytes = sizeOnDisk;
                            }
                        } while (internalIterator.MoveNext());
                    }
                    res.Add(currentListsInfo);
                    currentListsInfo.AverageListItemSizeOnDiskInBytes = currentListsInfo.SizeOnDiskInBytes / currentListsInfo.Count;
                } while (iterator.MoveNext());
            }
            res.Sort((a, b) => b.SizeOnDiskInBytes.CompareTo(a.SizeOnDiskInBytes));
            return(res);
        }
Example #2
0
        public List <ListsInfo> GetListsStatsVerySlowly()
        {
            Api.JetSetCurrentIndex(session, Lists, "by_name_and_key");
            Api.MoveBeforeFirst(Session, Lists);
            string           currentName      = null;
            List <ListsInfo> res              = new List <ListsInfo>();
            ListsInfo        currentListsInfo = null;

            while (Api.TryMoveNext(Session, Lists))
            {
                //Since i iterate on an index that starts with name i now that a specific list item comes sequentially
                var name = Api.RetrieveColumnAsString(Session, Lists, tableColumnsCache.ListsColumns["name"],
                                                      Encoding.Unicode);
                if (currentName != name)
                {
                    if (currentListsInfo != null)
                    {
                        res.Add(currentListsInfo);
                        currentListsInfo.AverageListItemSizeOnDiskInBytes = currentListsInfo.SizeOnDiskInBytes / currentListsInfo.Count;
                    }
                    currentListsInfo = new ListsInfo {
                        Name = name
                    };
                }
                currentName = name;
                var sizeOnDisk = Api.RetrieveColumnSize(session, Lists, tableColumnsCache.ListsColumns["data"]);
                currentListsInfo.Count++;
                if (sizeOnDisk.HasValue)
                {
                    currentListsInfo.SizeOnDiskInBytes += sizeOnDisk.Value;
                    if (sizeOnDisk.Value > currentListsInfo.MaxListItemSizeOnDiskInBytes)
                    {
                        currentListsInfo.MaxListItemSizeOnDiskInBytes = sizeOnDisk.Value;
                    }
                    if (currentListsInfo.MinListItemSizeOnDiskInBytes == 0 || sizeOnDisk.Value < currentListsInfo.MinListItemSizeOnDiskInBytes)
                    {
                        currentListsInfo.MinListItemSizeOnDiskInBytes = sizeOnDisk.Value;
                    }
                }
            }
            res.Add(currentListsInfo);
            currentListsInfo.AverageListItemSizeOnDiskInBytes = currentListsInfo.SizeOnDiskInBytes / currentListsInfo.Count;
            res.Sort((a, b) => b.SizeOnDiskInBytes.CompareTo(a.SizeOnDiskInBytes));
            return(res);
        }
Example #3
0
 public List<ListsInfo> GetListsStatsVerySlowly()
 {
     string currentName = null;
     List<ListsInfo> res = new List<ListsInfo>();
     ListsInfo currentListsInfo = null;
     var listsByName = tableStorage.Lists.GetIndex(Tables.Lists.Indices.ByName);
     using (var iterator = listsByName.Iterate(Snapshot, writeBatch.Value))
     {
         if (!iterator.Seek(Slice.BeforeAllKeys))
         {
             return res;
         }
         do
         {
             currentListsInfo = new ListsInfo() {Name = iterator.CurrentKey.ToString()};
             using (var internalIterator = listsByName.MultiRead(Snapshot, iterator.CurrentKey)) 
             {
                 if (!internalIterator.Seek(Slice.BeforeAllKeys))
                 {
                     continue;
                 }
                 do
                 {                        
                     var sizeOnDisk = iterator.GetCurrentDataSize();
                     currentListsInfo.Count++;
                     currentListsInfo.SizeOnDiskInBytes += sizeOnDisk;
                     if (sizeOnDisk > currentListsInfo.MaxListItemSizeOnDiskInBytes)
                         currentListsInfo.MaxListItemSizeOnDiskInBytes = sizeOnDisk;
                     if (currentListsInfo.MinListItemSizeOnDiskInBytes == 0 || sizeOnDisk < currentListsInfo.MinListItemSizeOnDiskInBytes)
                         currentListsInfo.MinListItemSizeOnDiskInBytes = sizeOnDisk;
                 } while (internalIterator.MoveNext());
             }
             res.Add(currentListsInfo);
             currentListsInfo.AverageListItemSizeOnDiskInBytes = currentListsInfo.SizeOnDiskInBytes / currentListsInfo.Count;
         } while (iterator.MoveNext());
     }
     res.Sort((a, b) => b.SizeOnDiskInBytes.CompareTo(a.SizeOnDiskInBytes));
     return res;
 }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminPopedom.IsHoldModel("04");

        DataTable sdt  = new DataTable();
        string    sqlt = "select NameID,ComName from TGameNameInfo where Enable=1 ";

        sdt = DbSession.Default.FromSql(sqlt).ToDataTable();           //sqlconn.sqlReader(sqlt);
        if (sdt.Rows.Count > 0)
        {
            GameLists.DataSource = sdt;
            GameLists.DataBind();
        }
        else
        {
            this.NoGameList.Visible = true;
        }
        sdt.Clear();

        ids = CommonManager.Web.Request("id", "");           //Limit.editCharacter(Limit.getFormValue("id"));
        if (ids.ToString() == "")
        {
            ids = "1001";
        }
        if (ids != "")
        {
            DataTable sd2  = new DataTable();
            string    sql2 = "select ComName from TGameNameInfo where NameID=" + ids + "";
            //Response.Write(sql2 + "<br>");
            sd2 = DbSession.Default.FromSql(sql2).ToDataTable();               //sqlconn.sqlReader(sql2);
            if (sd2.Rows.Count > 0)
            {
                this.ComName = sd2.Rows[0]["ComName"].ToString();
            }
            else
            {
                //Limit.outMsgBox( "温馨提示:\\n\\n 暂无任何记录!", true );
                CommonManager.Web.RegJs(this, "alert('暂无任何记录。');", false);
                return;
            }
        }
        else
        {
            CommonManager.Web.RegJs(this, "alert('参数传递错误。');", false);
            return;
        }
        sdt.Clear();
        DataTable sd = new DataTable();
        //string sqlActive = "select top 30 u.name as name,r.win as win,r.lost as lost,r.cut as cut,r.PlayTimeCount as PlayTimeCount";
        //sqlActive = sqlActive + ",r.OnLineTimeCount as OnLineTimeCount,r.point as point from " + SearchTable + " as r,Users as u where u.userid=r.userid order by point desc";
        string sqlActive = "select * from Web_VMatchTable where Nameid=" + ids + "";

        //Response.Write(sqlActive);
        sd = DbSession.Default.FromSql(sqlActive).ToDataTable();           //sqlconn.sqlReader(sqlActive);
        //Response.End();
        if (sd.Rows.Count > 0)
        {
            ListsInfo.DataSource = sd;
            ListsInfo.DataBind();
        }
        else
        {
            this.NoList.Visible = true;
        }
        sd.Clear();
    }