From 5cb86dc6964507da30cb78ea8a5daa9b4a46d364 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 28 Mar 2021 19:32:35 -0500 Subject: [PATCH] Add more timer logs --- IPA.Injector/Injector.cs | 6 ++++++ IPA.Injector/PermissionFix.cs | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/IPA.Injector/Injector.cs b/IPA.Injector/Injector.cs index 6fd34208..1ea7e058 100644 --- a/IPA.Injector/Injector.cs +++ b/IPA.Injector/Injector.cs @@ -6,6 +6,7 @@ using IPA.Utilities; using Mono.Cecil; using Mono.Cecil.Cil; using System; +using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -128,6 +129,8 @@ namespace IPA.Injector private static void InstallBootstrapPatch() { + var sw = Stopwatch.StartNew(); + var cAsmName = Assembly.GetExecutingAssembly().GetName(); var managedPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); @@ -296,6 +299,9 @@ namespace IPA.Injector #endif } #endregion + + sw.Stop(); + injector.Info($"Installing bootstrapper took {sw.Elapsed}"); } private static bool bootstrapped; diff --git a/IPA.Injector/PermissionFix.cs b/IPA.Injector/PermissionFix.cs index 58e9dadb..7b531e52 100644 --- a/IPA.Injector/PermissionFix.cs +++ b/IPA.Injector/PermissionFix.cs @@ -1,4 +1,7 @@ -using System; +using IPA.Logging; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Security.AccessControl; using System.Security.Principal; @@ -10,13 +13,16 @@ using Net3_Proxy; namespace IPA.Injector { internal static class PermissionFix - { + { + [SuppressMessage("Reliability", "CA2008:Do not create tasks without passing a TaskScheduler", + Justification = "I very explicitly want the default scheduler")] public static Task FixPermissions(DirectoryInfo root) { if (!root.Exists) return new Task(() => { }); return Task.Factory.StartNew(() => { + var sw = Stopwatch.StartNew(); try { var acl = root.GetAccessControl(); @@ -56,9 +62,11 @@ namespace IPA.Injector } catch (Exception e) { - Logging.Logger.log.Warn("Error configuring permissions in the game install dir"); - Logging.Logger.log.Warn(e); + Logger.log.Warn("Error configuring permissions in the game install dir"); + Logger.log.Warn(e); } + sw.Stop(); + Logger.log.Info($"Configuring permissions took {sw.Elapsed}"); }); } }