Volian.Base.Library & Baseline

This commit is contained in:
2026-08-11 07:33:32 -04:00
parent 6d7d127b63
commit b1427f4997
26 changed files with 389 additions and 1239 deletions
+32 -81
View File
@@ -1,26 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volian.Base.Library
{
public class VlnTimer
{
private DateTime _LastTime = DateTime.Now;
public DateTime LastTime
public DateTime LastTime { get; set; } = DateTime.Now;
public string LastProcess { get; set; } = "Initialize";
public string ActiveProcess
{
get { return _LastTime; }
set { _LastTime = value; }
}
private string _LastProcess = "Initialize";
public string LastProcess
{
get { return _LastProcess; }
set { _LastProcess = value; }
}
public string ActiveProcess
{
get { return _LastProcess; }
get { return LastProcess; }
set
{
DateTime tNow = DateTime.Now;
@@ -33,13 +22,9 @@ namespace Volian.Base.Library
LastProcess = value;
}
}
Dictionary<string, TimeSpan> _ElapsedTimes = new Dictionary<string, TimeSpan>();
public Dictionary<string, TimeSpan> ElapsedTimes
{
get { return _ElapsedTimes; }
set { _ElapsedTimes = value; }
}
public void ShowElapsedTimes()
public Dictionary<string, TimeSpan> ElapsedTimes { get; set; } = new Dictionary<string, TimeSpan>();
public void ShowElapsedTimes()
{
ActiveProcess = "fini";
Console.WriteLine("'Process'\t'Elapsed'");
@@ -54,27 +39,16 @@ namespace Volian.Base.Library
}
public static class ProfileTimer
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static Stack<string> _MyStack = new Stack<string>();
#pragma warning disable S6669
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#pragma warning restore S6669
public static Stack<string> MyStack
{
get { return _MyStack; }
set { _MyStack = value; }
}
private static DateTime _StartTime = DateTime.Now;
public static DateTime StartTime
{
get { return _StartTime; }
set { _StartTime = value; }
}
delegate int DoPushTrack(string start);
public static Stack<string> MyStack { get; set; } = new Stack<string>();
public static DateTime StartTime { get; set; } = DateTime.Now;
delegate int DoPushTrack(string start);
private static DoPushTrack myDoPush = new DoPushTrack(IgnorePush);
public static int Push(string start)
{
return DoPush(start);
}
private static int DoPush(string start)
public static int Push(string start) => DoPush(start);
private static int DoPush(string start)
{
MyStack.Push(Start);
Start = start;
@@ -87,39 +61,23 @@ namespace Volian.Base.Library
}
delegate int DoPopTrack(int depth);
private static DoPopTrack myDoPop = new DoPopTrack(IgnorePop);
public static int Pop(int depth)
{
return DoPop(depth);
}
private static int DoPop(int depth)
public static int Pop(int depth) => DoPop(depth);
private static int DoPop(int depth)
{
if (MyStack.Count != depth)
_MyLog.WarnFormat("Profile Stack Issues\r\n {0}, Depth is {1}, Depth should be {2}", Start,MyStack.Count,depth);
Start = MyStack.Pop();
return MyStack.Count;
}
private static int IgnorePop(int depth)
{
return 0;
}
public static int Depth
{
get
{
return MyStack.Count;
}
}
private static Dictionary<string, long> _TimerTable = new Dictionary<string, long>();
public static Dictionary<string, long> TimerTable
{
get { return ProfileTimer._TimerTable; }
set { ProfileTimer._TimerTable = value; }
}
delegate void DoTrack(string module);
private static int IgnorePop(int depth) => 0;
public static int Depth => MyStack.Count;
public static Dictionary<string, long> TimerTable { get; set; } = new Dictionary<string, long>();
delegate void DoTrack(string module);
private static DoTrack myDoTrack = new DoTrack(IgnoreModule);
public static void TurnOnTracking(string filename)
{
DebugProfile.Open(VlnSettings.TemporaryFolder + "\\" + filename);
DebugProfile.Open($"{VlnSettings.TemporaryFolder}\\{filename}");
myDoTrack = new DoTrack(TrackModule);
myDoPush = new DoPushTrack(DoPush);
myDoPop = new DoPopTrack(DoPop);
@@ -145,13 +103,10 @@ namespace Volian.Base.Library
//Console.WriteLine("{0},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - LastTime.Ticks).TotalSeconds, Description);
AddTimerInfo(_Start, dtNext.Ticks - LastTime.Ticks);
_Start = module;
_LastTime = dtNext;
LastTime = dtNext;
}
private static void IgnoreModule(string module)
{
_Start = module;
}
private static void AddTimerInfo(string description, long ticks)
private static void IgnoreModule(string module) => _Start = module;
private static void AddTimerInfo(string description, long ticks)
{
if (TimerTable.ContainsKey(description))
TimerTable[description] += ticks;
@@ -205,16 +160,12 @@ namespace Volian.Base.Library
}
public static void Reset()
{
_TimerTable = new Dictionary<string, long>();
TimerTable = new Dictionary<string, long>();
_Start = "Start";
_LastTime = DateTime.Now;
_MyStack = new Stack<string>();
LastTime = DateTime.Now;
MyStack = new Stack<string>();
}
private static DateTime _LastTime = DateTime.Now;
public static DateTime LastTime
{
get { return _LastTime; }
set { _LastTime = value; }
}
}
public static DateTime LastTime { get; set; } = DateTime.Now;
}
}