chore: add some timings for Tier 2 init

This commit is contained in:
goaaats 2022-06-21 21:52:44 +02:00
parent 8d33252cee
commit c72581d3bb
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
2 changed files with 67 additions and 41 deletions

View file

@ -185,21 +185,27 @@ namespace Dalamud
Service<NetworkHandlers>.Set();
Log.Information("[T2] NH OK!");
using (Timings.Start("DM Init"))
{
try
{
Service<DataManager>.Set().Initialize(this.AssetDirectory.FullName);
}
catch (Exception e)
{
Log.Error(e, "Could not initialize DataManager.");
Log.Error(e, "Could not initialize DataManager");
this.Unload();
return false;
}
}
Log.Information("[T2] Data OK!");
var clientState = Service<ClientState>.Set();
using (Timings.Start("CS Init"))
{
Service<ClientState>.Set();
Log.Information("[T2] CS OK!");
}
var localization = Service<Localization>.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
using (Timings.Start("IME Init"))
{
Service<DalamudIME>.Set();
Log.Information("[T2] IME OK!");
}
using (Timings.Start("IM Enable"))
{
Service<InterfaceManager>.Set().Enable();
Log.Information("[T2] IM OK!");
}
using (Timings.Start("GFM Init"))
{
Service<GameFontManager>.Set();
Log.Information("[T2] GFM OK!");
}
#pragma warning disable CS0618 // Type or member is obsolete
Service<SeStringManager>.Set();
@ -229,27 +244,30 @@ namespace Dalamud
Log.Information("[T2] SeString OK!");
// Initialize managers. Basically handlers for the logic
using (Timings.Start("CM Init"))
{
Service<CommandManager>.Set();
Service<DalamudCommands>.Set().SetupCommands();
Log.Information("[T2] CM OK!");
}
Service<ChatHandlers>.Set();
Log.Information("[T2] CH OK!");
clientState.Enable();
using (Timings.Start("CS Enable"))
{
Service<ClientState>.Get().Enable();
Log.Information("[T2] CS ENABLE!");
}
Service<DalamudAtkTweaks>.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;

View file

@ -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,6 +299,8 @@ namespace Dalamud.Data
Log.Verbose("Loaded {0} ClientOpCodes.", clientOpCodeDict.Count);
using (Timings.Start("Lumina Init"))
{
var luminaOptions = new LuminaOptions
{
CacheFileResources = true,
@ -314,8 +317,13 @@ namespace Dalamud.Data
{
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);
}
this.IsDataReady = true;