Exemplo n.º 1
0
 public static void print_memory(ConsoleSystem.Arg arg)
 {
     if (((Dictionary <System.Type, Pool.ICollection>)Pool.directory).Count == 0)
     {
         arg.ReplyWith("Memory pool is empty.");
     }
     else
     {
         TextTable textTable = new TextTable();
         textTable.AddColumn("type");
         textTable.AddColumn("pooled");
         textTable.AddColumn("active");
         textTable.AddColumn("hits");
         textTable.AddColumn("misses");
         textTable.AddColumn("spills");
         using (IEnumerator <KeyValuePair <System.Type, Pool.ICollection> > enumerator = ((IEnumerable <KeyValuePair <System.Type, Pool.ICollection> >)((IEnumerable <KeyValuePair <System.Type, Pool.ICollection> >)Pool.directory).OrderByDescending <KeyValuePair <System.Type, Pool.ICollection>, long>((Func <KeyValuePair <System.Type, Pool.ICollection>, long>)(x => x.Value.get_ItemsCreated()))).GetEnumerator())
         {
             while (((IEnumerator)enumerator).MoveNext())
             {
                 KeyValuePair <System.Type, Pool.ICollection> current = enumerator.Current;
                 string           str         = current.Key.ToString().Replace("System.Collections.Generic.", "");
                 Pool.ICollection icollection = current.Value;
                 textTable.AddRow(new string[6]
                 {
                     str,
                     NumberExtensions.FormatNumberShort(icollection.get_ItemsInStack()),
                     NumberExtensions.FormatNumberShort(icollection.get_ItemsInUse()),
                     NumberExtensions.FormatNumberShort(icollection.get_ItemsTaken()),
                     NumberExtensions.FormatNumberShort(icollection.get_ItemsCreated()),
                     NumberExtensions.FormatNumberShort(icollection.get_ItemsSpilled())
                 });
             }
         }
         arg.ReplyWith(((object)textTable).ToString());
     }
 }