private void UpdateStatus() { if ((double)this.nextUpdate > (double)Time.get_realtimeSinceStartup() || Net.sv == null || !((Server)Net.sv).IsConnected()) { return; } this.nextUpdate = Time.get_realtimeSinceStartup() + 0.33f; if (!this.input.valid) { return; } string str1 = NumberExtensions.FormatSeconds((long)Time.get_realtimeSinceStartup()); string str2 = " " + this.currentGameTime.ToString("[H:mm]") + " [" + (object)this.currentPlayerCount + "/" + (object)this.maxPlayerCount + "] " + Server.hostname + " [" + Server.level + "]"; string str3 = Performance.current.frameRate.ToString() + "fps " + (object)Performance.current.memoryCollections + "gc " + str1 ?? ""; string str4 = NumberExtensions.FormatBytes <ulong>((M0)(long)((NetworkPeer)Net.sv).GetStat((Connection)null, (NetworkPeer.StatTypeLong) 3), true) + "/s in, " + NumberExtensions.FormatBytes <ulong>((M0)(long)((NetworkPeer)Net.sv).GetStat((Connection)null, (NetworkPeer.StatTypeLong) 1), true) + "/s out"; string str5 = str3.PadLeft(this.input.lineWidth - 1); string str6 = str2 + (str2.Length < str5.Length ? str5.Substring(str2.Length) : ""); string str7 = " " + this.currentEntityCount.ToString("n0") + " ents, " + this.currentSleeperCount.ToString("n0") + " slprs"; string str8 = str4.PadLeft(this.input.lineWidth - 1); string str9 = str7 + (str7.Length < str8.Length ? str8.Substring(str7.Length) : ""); this.input.statusText[0] = ""; this.input.statusText[1] = str6; this.input.statusText[2] = str9; }
public static void textures(ConsoleSystem.Arg args) { M0[] objectsOfType = Object.FindObjectsOfType <Texture>(); string str1 = ""; foreach (Texture texture in (Texture[])objectsOfType) { string str2 = NumberExtensions.FormatBytes <int>((M0)Profiler.GetRuntimeMemorySize((Object)texture), false); str1 = str1 + ((object)texture).ToString().PadRight(30) + ((Object)texture).get_name().PadRight(30) + str2 + "\n"; } args.ReplyWith(str1); }
public static void objects(ConsoleSystem.Arg args) { M0[] objectsOfType = Object.FindObjectsOfType <Object>(); string str = ""; Dictionary <System.Type, int> dictionary = new Dictionary <System.Type, int>(); Dictionary <System.Type, long> source = new Dictionary <System.Type, long>(); foreach (Object @object in (Object[])objectsOfType) { int runtimeMemorySize = Profiler.GetRuntimeMemorySize(@object); if (dictionary.ContainsKey(((object)@object).GetType())) { dictionary[((object)@object).GetType()]++; } else { dictionary.Add(((object)@object).GetType(), 1); } if (source.ContainsKey(((object)@object).GetType())) { source[((object)@object).GetType()] += (long)runtimeMemorySize; } else { source.Add(((object)@object).GetType(), (long)runtimeMemorySize); } } foreach (KeyValuePair <System.Type, long> keyValuePair in (IEnumerable <KeyValuePair <System.Type, long> >)source.OrderByDescending <KeyValuePair <System.Type, long>, long>((Func <KeyValuePair <System.Type, long>, long>)(x => x.Value))) { str = str + dictionary[keyValuePair.Key].ToString().PadLeft(10) + " " + NumberExtensions.FormatBytes <long>((M0)keyValuePair.Value, false).PadLeft(15) + "\t" + (object)keyValuePair.Key + "\n"; } args.ReplyWith(str); }
public void LogSize(object obj, ulong size) { Debug.Log((object)(obj.GetType().ToString() + " allocated: " + NumberExtensions.FormatBytes <ulong>((M0)(long)size, false))); }