add benchmark during digestion
This commit is contained in:
parent
d79cdf9c92
commit
3b50abebe4
|
|
@ -60,16 +60,12 @@ public static class Benchmark
|
||||||
string key = MakeKey(id, member, file);
|
string key = MakeKey(id, member, file);
|
||||||
|
|
||||||
if (!_clocks.TryGetValue(key, out Stopwatch sw)) {
|
if (!_clocks.TryGetValue(key, out Stopwatch sw)) {
|
||||||
#if LOG
|
_logger.Debug($"No clock found for '{key}', start one first using Benchmark.Start()");
|
||||||
_logger.Debug($"No clock found for '{key}', start one first using Benchmark.Start()");
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
#if LOG
|
IO.Console.Write($" ::: {key}:{line} > {message ?? "Elapsed"}: {sw.Elapsed}");
|
||||||
_logger.Debug($" ::: {key}:{line} > {message ?? "Elapsed"}: {sw.Elapsed}");
|
|
||||||
#endif
|
|
||||||
if (keep)
|
if (keep)
|
||||||
sw.Start();
|
sw.Start();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ public class Digester : ISteppable<Token>
|
||||||
|
|
||||||
public Function Digest()
|
public Function Digest()
|
||||||
{
|
{
|
||||||
|
Benchmark.Active = true;
|
||||||
|
Benchmark.Start($"Digest begin");
|
||||||
#if LOG
|
#if LOG
|
||||||
_logger.Method();
|
_logger.Method();
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -101,6 +103,7 @@ public class Digester : ISteppable<Token>
|
||||||
#if LOG
|
#if LOG
|
||||||
_logger.Verbose(_debug.Debug());
|
_logger.Verbose(_debug.Debug());
|
||||||
#endif
|
#endif
|
||||||
|
Benchmark.End($"Digest end");
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue