public static void print_memory(ConsoleSystem.Arg arg) { if (Facepunch.Pool.directory.Count == 0) { arg.ReplyWith("Memory pool is empty."); return; } TextTable textTable = new TextTable(); textTable.AddColumn("type"); textTable.AddColumn("pooled"); textTable.AddColumn("active"); textTable.AddColumn("hits"); textTable.AddColumn("misses"); textTable.AddColumn("spills"); foreach (KeyValuePair <Type, Facepunch.Pool.ICollection> keyValuePair in from x in Facepunch.Pool.directory orderby x.Value.ItemsCreated descending select x) { string str = keyValuePair.Key.ToString().Replace("System.Collections.Generic.", ""); Facepunch.Pool.ICollection value = keyValuePair.Value; textTable.AddRow(new string[] { str, value.ItemsInStack.FormatNumberShort(), value.ItemsInUse.FormatNumberShort(), value.ItemsTaken.FormatNumberShort(), value.ItemsCreated.FormatNumberShort(), value.ItemsSpilled.FormatNumberShort() }); } arg.ReplyWith(textTable.ToString()); }
public static void print_memory(Arg arg) { if (Facepunch.Pool.directory.Count == 0) { arg.ReplyWith("Memory pool is empty."); return; } TextTable textTable = new TextTable(); textTable.AddColumn("type"); textTable.AddColumn("pooled"); textTable.AddColumn("active"); textTable.AddColumn("hits"); textTable.AddColumn("misses"); textTable.AddColumn("spills"); foreach (KeyValuePair <Type, Facepunch.Pool.ICollection> item in Facepunch.Pool.directory.OrderByDescending((KeyValuePair <Type, Facepunch.Pool.ICollection> x) => x.Value.ItemsCreated)) { string text = item.Key.ToString().Replace("System.Collections.Generic.", ""); Facepunch.Pool.ICollection value = item.Value; textTable.AddRow(text, value.ItemsInStack.FormatNumberShort(), value.ItemsInUse.FormatNumberShort(), value.ItemsTaken.FormatNumberShort(), value.ItemsCreated.FormatNumberShort(), value.ItemsSpilled.FormatNumberShort()); } arg.ReplyWith(textTable.ToString()); }