From 3b50abebe4958fa56dfa5b7f1ded17084fd0748a Mon Sep 17 00:00:00 2001 From: Qrakhen Date: Thu, 11 Dec 2025 18:25:01 +0100 Subject: [PATCH] add benchmark during digestion --- Qrakhen.Qamp.Core/Benchmark.cs | 8 ++------ Qrakhen.Qamp.Core/Compilation/Digester.cs | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Qrakhen.Qamp.Core/Benchmark.cs b/Qrakhen.Qamp.Core/Benchmark.cs index 10e4708..5b3797d 100644 --- a/Qrakhen.Qamp.Core/Benchmark.cs +++ b/Qrakhen.Qamp.Core/Benchmark.cs @@ -60,16 +60,12 @@ public static class Benchmark string key = MakeKey(id, member, file); if (!_clocks.TryGetValue(key, out Stopwatch sw)) { -#if LOG - _logger.Debug($"No clock found for '{key}', start one first using Benchmark.Start()"); -#endif + _logger.Debug($"No clock found for '{key}', start one first using Benchmark.Start()"); return 0; } sw.Stop(); -#if LOG - _logger.Debug($" ::: {key}:{line} > {message ?? "Elapsed"}: {sw.Elapsed}"); -#endif + IO.Console.Write($" ::: {key}:{line} > {message ?? "Elapsed"}: {sw.Elapsed}"); if (keep) sw.Start(); diff --git a/Qrakhen.Qamp.Core/Compilation/Digester.cs b/Qrakhen.Qamp.Core/Compilation/Digester.cs index fcaf9b5..3118224 100644 --- a/Qrakhen.Qamp.Core/Compilation/Digester.cs +++ b/Qrakhen.Qamp.Core/Compilation/Digester.cs @@ -76,6 +76,8 @@ public class Digester : ISteppable public Function Digest() { + Benchmark.Active = true; + Benchmark.Start($"Digest begin"); #if LOG _logger.Method(); #endif @@ -101,6 +103,7 @@ public class Digester : ISteppable #if LOG _logger.Verbose(_debug.Debug()); #endif + Benchmark.End($"Digest end"); return function; }