private void endZoneImpl(string name) { if (!SaveZoneUpdates) { endZoneNoSave(); return; } PerformanceReport performanceReport = new PerformanceReport(); if (!loadFromFileSystem(currentPerfReport, performanceReport)) { Log.LogErrorFormatted(this, "EndZone, Failed to load performance report file: {0}", currentPerfReport); return; } PerformanceZoneReport performanceZoneReport = new PerformanceZoneReport(); performanceZoneReport.Name = name; performanceZoneReport.StartTime = currentZoneStart * 1000f; performanceZoneReport.Length = (Time.realtimeSinceStartup - currentZoneStart) * 1000f; performanceZoneReport.Frame = Time.frameCount; PerformanceZoneReport item = performanceZoneReport; updateMetrics(); UpdateAssetMemoryUsage(); endZoneNoSave(); performanceReport.Zones.Add(item); saveToFileSystem(currentPerfReport, performanceReport.ToJson()); }
private static bool loadFromFileSystem(string path, PerformanceReport profile) { try { string json = File.ReadAllText(path); JsonData json2 = JsonMapper.ToObject(json); profile.FromJson(json2); return(true); } catch (Exception) { return(false); } }
private void createProfileLog() { string date = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd-THH.mm.ss"); string text = Application.persistentDataPath + "/profile/" + getProfileFileName(date); text = (currentPerfReport = text + ".json"); PerformanceReport performanceReport = new PerformanceReport(); performanceReport.Platform = ClientInfo.Instance.Platform; performanceReport.OperatingSystem = SystemInfo.operatingSystem; performanceReport.Device = SystemInfo.deviceModel; performanceReport.BundleId = Application.identifier; performanceReport.Version = ClientInfo.Instance.BuildVersion; performanceReport.UnityVersion = Application.unityVersion; performanceReport.Date = date; performanceReport.StartTime = DateTime.Now.ToUniversalTime().ToFileTime(); PerformanceReport performanceReport2 = performanceReport; saveToFileSystem(text, performanceReport2.ToJson()); }