diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 9792559da..9288a0384 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -185,21 +185,27 @@ namespace Dalamud Service.Set(); Log.Information("[T2] NH OK!"); - try + using (Timings.Start("DM Init")) { - Service.Set().Initialize(this.AssetDirectory.FullName); - } - catch (Exception e) - { - Log.Error(e, "Could not initialize DataManager."); - this.Unload(); - return false; + try + { + Service.Set().Initialize(this.AssetDirectory.FullName); + } + catch (Exception e) + { + Log.Error(e, "Could not initialize DataManager"); + this.Unload(); + return false; + } } Log.Information("[T2] Data OK!"); - var clientState = Service.Set(); - Log.Information("[T2] CS OK!"); + using (Timings.Start("CS Init")) + { + Service.Set(); + Log.Information("[T2] CS OK!"); + } var localization = Service.Set(new Localization(Path.Combine(this.AssetDirectory.FullName, "UIRes", "loc", "dalamud"), "dalamud_")); if (!string.IsNullOrEmpty(configuration.LanguageOverride)) @@ -214,14 +220,23 @@ namespace Dalamud Log.Information("[T2] LOC OK!"); // This is enabled in ImGuiScene setup - Service.Set(); - Log.Information("[T2] IME OK!"); + using (Timings.Start("IME Init")) + { + Service.Set(); + Log.Information("[T2] IME OK!"); + } - Service.Set().Enable(); - Log.Information("[T2] IM OK!"); + using (Timings.Start("IM Enable")) + { + Service.Set().Enable(); + Log.Information("[T2] IM OK!"); + } - Service.Set(); - Log.Information("[T2] GFM OK!"); + using (Timings.Start("GFM Init")) + { + Service.Set(); + Log.Information("[T2] GFM OK!"); + } #pragma warning disable CS0618 // Type or member is obsolete Service.Set(); @@ -229,27 +244,30 @@ namespace Dalamud Log.Information("[T2] SeString OK!"); - // Initialize managers. Basically handlers for the logic - Service.Set(); - - Service.Set().SetupCommands(); - - Log.Information("[T2] CM OK!"); + using (Timings.Start("CM Init")) + { + Service.Set(); + Service.Set().SetupCommands(); + Log.Information("[T2] CM OK!"); + } Service.Set(); - Log.Information("[T2] CH OK!"); - clientState.Enable(); - Log.Information("[T2] CS ENABLE!"); + using (Timings.Start("CS Enable")) + { + Service.Get().Enable(); + Log.Information("[T2] CS ENABLE!"); + } Service.Set().Enable(); + Log.Information("[T2] ATKTWEAKS ENABLE!"); Log.Information("[T2] Load complete!"); } catch (Exception ex) { - Log.Error(ex, "Tier 2 load failed."); + Log.Error(ex, "Tier 2 load failed"); this.Unload(); return false; } @@ -308,17 +326,17 @@ namespace Dalamud } catch (Exception ex) { - Log.Error(ex, "Plugin load failed."); + Log.Error(ex, "Plugin load failed"); } Troubleshooting.LogTroubleshooting(); - Log.Information("Dalamud is ready."); + Log.Information("Dalamud is ready"); Timings.Event("Dalamud ready"); } catch (Exception ex) { - Log.Error(ex, "Tier 3 load failed."); + Log.Error(ex, "Tier 3 load failed"); this.Unload(); return false; diff --git a/Dalamud/Data/DataManager.cs b/Dalamud/Data/DataManager.cs index 8697dc930..2e679ab23 100644 --- a/Dalamud/Data/DataManager.cs +++ b/Dalamud/Data/DataManager.cs @@ -9,6 +9,7 @@ using Dalamud.Interface.Internal; using Dalamud.IoC; using Dalamud.IoC.Internal; using Dalamud.Utility; +using Dalamud.Utility.Timing; using ImGuiScene; using JetBrains.Annotations; using Lumina; @@ -298,25 +299,32 @@ namespace Dalamud.Data Log.Verbose("Loaded {0} ClientOpCodes.", clientOpCodeDict.Count); - var luminaOptions = new LuminaOptions + using (Timings.Start("Lumina Init")) { - CacheFileResources = true, + var luminaOptions = new LuminaOptions + { + CacheFileResources = true, #if DEBUG - PanicOnSheetChecksumMismatch = true, + PanicOnSheetChecksumMismatch = true, #else - PanicOnSheetChecksumMismatch = false, + PanicOnSheetChecksumMismatch = false, #endif - DefaultExcelLanguage = this.Language.ToLumina(), - }; + DefaultExcelLanguage = this.Language.ToLumina(), + }; - var processModule = Process.GetCurrentProcess().MainModule; - if (processModule != null) - { - this.GameData = new GameData(Path.Combine(Path.GetDirectoryName(processModule.FileName), "sqpack"), luminaOptions); + var processModule = Process.GetCurrentProcess().MainModule; + if (processModule != null) + { + this.GameData = new GameData(Path.Combine(Path.GetDirectoryName(processModule.FileName), "sqpack"), luminaOptions); + } + else + { + throw new Exception("Could not main module."); + } + + Log.Information("Lumina is ready: {0}", this.GameData.DataPath); } - Log.Information("Lumina is ready: {0}", this.GameData.DataPath); - this.IsDataReady = true; this.luminaCancellationTokenSource = new();