打印混淆耗各个pass耗时和总耗时

before-split
walon 2025-05-30 09:51:57 +08:00
parent dcd38e288b
commit f0c09ad741
2 changed files with 10 additions and 2 deletions

View File

@ -90,14 +90,17 @@ namespace Obfuz
public void Run() public void Run()
{ {
Debug.Log($"Obfuscator Run. begin"); Debug.Log($"Obfuscator begin");
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
FileUtil.RecreateDir(_coreSettings.obfuscatedAssemblyOutputPath); FileUtil.RecreateDir(_coreSettings.obfuscatedAssemblyOutputPath);
FileUtil.RecreateDir(_coreSettings.obfuscatedAssemblyTempOutputPath); FileUtil.RecreateDir(_coreSettings.obfuscatedAssemblyTempOutputPath);
RunPipeline(_pipeline1); RunPipeline(_pipeline1);
_assemblyResolver.InsertFirst(new PathAssemblyResolver(_coreSettings.obfuscatedAssemblyTempOutputPath)); _assemblyResolver.InsertFirst(new PathAssemblyResolver(_coreSettings.obfuscatedAssemblyTempOutputPath));
RunPipeline(_pipeline2); RunPipeline(_pipeline2);
FileUtil.CopyDir(_coreSettings.obfuscatedAssemblyTempOutputPath, _coreSettings.obfuscatedAssemblyOutputPath, true); FileUtil.CopyDir(_coreSettings.obfuscatedAssemblyTempOutputPath, _coreSettings.obfuscatedAssemblyOutputPath, true);
Debug.Log($"Obfuscator Run. end"); sw.Stop();
Debug.Log($"Obfuscator end. cost time: {sw.ElapsedMilliseconds} ms");
} }
private void RunPipeline(Pipeline pipeline) private void RunPipeline(Pipeline pipeline)

View File

@ -1,5 +1,6 @@
using Obfuz.ObfusPasses; using Obfuz.ObfusPasses;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
namespace Obfuz namespace Obfuz
{ {
@ -34,9 +35,13 @@ namespace Obfuz
public void Run() public void Run()
{ {
var sw = new Stopwatch();
foreach (var pass in _passes) foreach (var pass in _passes)
{ {
sw.Restart();
pass.Process(); pass.Process();
sw.Stop();
UnityEngine.Debug.Log($"Pass: {pass.GetType().Name} process cost time: {sw.ElapsedMilliseconds}ms");
} }
} }
} }