Exemplo n.º 1
0
        internal void SaveStats()
        {
            try
            {
                Util.DebugPrint("Saving stats to", filepath);
                w = new StreamWriter(filepath, append: true);
                H2("Loading stats");
                H3("Performance");
                Stat("Custom assets loaded", AssetLoader.instance.assetCount, "assets");
                int dt = AssetLoader.instance.lastMillis - AssetLoader.instance.beginMillis;

                if (dt > 0)
                {
                    Stat("Loading speed", (AssetLoader.instance.assetCount * 1000f / dt).ToString("F1"), "assets / second");
                }

                Stat("Custom assets loading time", Profiling.TimeString(dt + 500), "minutes:seconds");
                Stat("Total loading time", Profiling.TimeString(Profiling.Millis + 500), "minutes:seconds");

                if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
                {
                    H3("Peak memory usage");
                    Stat("RAM", (MemoryAPI.wsMax / 1024f).ToString("F1"), "GB");
                    Stat("Virtual memory", (MemoryAPI.pfMax / 1024f).ToString("F1"), "GB");
                }

                H3("Sharing of custom asset resources");
                Stat("Textures", texturesShared, "times");
                Stat("Materials", materialsShared, "times");
                Stat("Meshes", meshesShared, "times");

                H3("Skipped prefabs");
                int[] counts = LevelLoader.instance.skipCounts;
                Stat("Building prefabs", counts[Matcher.BUILDINGS], string.Empty);
                Stat("Vehicle prefabs", counts[Matcher.VEHICLES], string.Empty);
                Stat("Prop prefabs", counts[Matcher.PROPS], string.Empty);
                w.WriteLine(@"</body></html>");
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogException(e);
            }
            finally
            {
                w?.Dispose();
                w = null;
            }
        }
Exemplo n.º 2
0
 protected internal override string CreateText() => Profiling.TimeString(Profiling.Millis);