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nostics/ConsoleTraceListener.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/ConsoleTraceListener.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Implab.Diagnostics { + public class ConsoleTraceListener { + + static readonly object _consoleLock = new object(); + + public void Subscribe() { + LogChannel.Default.Events += Default_Events; + } + + public void Unsubscribe() { + LogChannel.Default.Events -= Default_Events; + } + + void Default_Events(object sender, ValueEventArgs e) { + LogEvent((TraceContext)sender, e.Value); + } + + void LogEvent(TraceContext context, TraceEvent evt) { + var msg = new StringBuilder(); + for (int i = 0; i < context.CurrentOperation.Level; i++) + msg.Append(" "); + msg.Append(evt.EventType); + msg.AppendFormat("[{0}]: ",context.ThreadId); + msg.Append(evt.Message); + + lock (_consoleLock) { + Console.ForegroundColor = (ConsoleColor)(context.ThreadId % 15 + 1); + Console.WriteLine(msg.ToString()); + } + } + } +} diff --git a/Implab/Diagnostics/LogChannel.cs b/Implab/Diagnostics/LogChannel.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/LogChannel.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Implab.Diagnostics { + public class LogChannel { + static LogChannel _default = new LogChannel(); + + public static LogChannel Default { + get { + return _default; + } + } + + public event EventHandler> Events; + + public void LogEvent(TEvent data) { + var t = Events; + if (t!= null) + t(TraceContext.Current,new ValueEventArgs(data)); + } + + public void LogEvent(TraceContext context,TEvent data) { + var t = Events; + if (t != null) + t(context, new ValueEventArgs(data)); + } + } +} diff --git a/Implab/Diagnostics/LogicalOperation.cs b/Implab/Diagnostics/LogicalOperation.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/LogicalOperation.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Diagnostics { + public class LogicalOperation { + readonly LogicalOperation m_parent; + readonly string m_name; + readonly int m_level; + readonly int m_timestamp; + + public LogicalOperation() + : this(null, null) { + } + + public LogicalOperation(string name, LogicalOperation parent) { + m_name = name ?? String.Empty; + m_parent = parent; + + m_level = parent == null ? 0 : parent.Level + 1; + m_timestamp = Environment.TickCount; + } + + public int Duration { + get { + var dt = Environment.TickCount - m_timestamp; + return dt < 0 ? int.MaxValue + dt : dt; // handle overflow + } + } + + public LogicalOperation Parent { + get { + return m_parent; + } + } + + public int Level { + get { return m_level; } + } + + public string Name { + get { return m_name; } + } + } +} diff --git a/Implab/Diagnostics/TraceContext.cs b/Implab/Diagnostics/TraceContext.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/TraceContext.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Implab.Diagnostics { + public class TraceContext { + LogicalOperation m_currentOperation; + readonly LogicalOperation m_traceBound; + readonly int m_threadId; + readonly TraceContext m_parent; + + readonly static object _consoleLock = new object(); + + [ThreadStatic] + static TraceContext _current; + + public static TraceContext Current { + get { + if (_current == null) + _current = new TraceContext(); + return _current; + } + } + + TraceContext(TraceContext context) { + if (context == null) + throw new ArgumentNullException("context"); + + m_parent = context; + m_currentOperation = context.CurrentOperation; + m_traceBound = context.CurrentOperation; + m_threadId = Thread.CurrentThread.ManagedThreadId; + + LogEvent(TraceEventType.Transfer, "FORK {0}", context.ThreadId); + } + + TraceContext() { + m_currentOperation = new LogicalOperation(); + m_traceBound = m_currentOperation; + m_threadId = Thread.CurrentThread.ManagedThreadId; + } + + public static void Transfer(TraceContext from) { + _current = from == null ? new TraceContext() : new TraceContext(from); + } + + public TraceContext ParentContext { + get { + return m_parent; + } + } + + public LogicalOperation CurrentOperation { + get { + return m_currentOperation; + } + } + + public LogicalOperation TraceBound { + get { + return m_traceBound; + } + } + + public int ThreadId { + get { + return m_threadId; + } + } + + public void StartLogicalOperation() { + StartLogicalOperation(null); + } + + public void StartLogicalOperation(string name) { + LogEvent(TraceEventType.OperationStarted, "{0}", name); + m_currentOperation = new LogicalOperation(name, m_currentOperation); + } + + public void EndLogicalOperation() { + if (m_traceBound == m_currentOperation) { + LogEvent(TraceEventType.Error, "Trying to end the operation which isn't belongs to current trace"); + } else { + var op = m_currentOperation; + m_currentOperation = m_currentOperation.Parent; + LogEvent(TraceEventType.OperationCompleted, "{0} {1} ms", op.Name, op.Duration); + } + } + + void LogEvent(TraceEventType type, string format, params object[] args) { + LogChannel.Default.LogEvent(this, TraceEvent.Create(type, format, args)); + } + } +} diff --git a/Implab/Diagnostics/TraceEvent.cs b/Implab/Diagnostics/TraceEvent.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/TraceEvent.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Implab.Diagnostics { + public class TraceEvent { + public string Message { + get; + private set; + } + + public TraceEventType EventType { + get; + private set; + } + + public TraceEvent(TraceEventType type, string message) { + EventType = type; + Message = message; + } + + public static TraceEvent Create(TraceEventType type, string format, params object[] args) { + return new TraceEvent(type, String.Format(format, args)); + } + } +} diff --git a/Implab/Diagnostics/TraceEventType.cs b/Implab/Diagnostics/TraceEventType.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/TraceEventType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Diagnostics { + public enum TraceEventType { + Information = 1, + Warning, + Error, + OperationStarted, + OperationCompleted, + Transfer + } +} diff --git a/Implab/Diagnostics/TraceLog.cs b/Implab/Diagnostics/TraceLog.cs new file mode 100644 --- /dev/null +++ b/Implab/Diagnostics/TraceLog.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Implab.Diagnostics { + /// + /// Класс для публикации событий выполнения программы, события публикуются через + /// + public static class TraceLog { + [Conditional("TRACE")] + public static void Transfer(TraceContext from) { + TraceContext.Transfer(from); + } + + [Conditional("TRACE")] + public static void StartLogicalOperation() { + TraceContext.Current.StartLogicalOperation(); + } + + [Conditional("TRACE")] + public static void StartLogicalOperation(string name) { + TraceContext.Current.StartLogicalOperation(name); + } + + [Conditional("TRACE")] + public static void EndLogicalOperation() { + TraceContext.Current.EndLogicalOperation(); + } + + [Conditional("TRACE")] + public static void TraceInformation(string format, params object[] arguments) { + LogChannel.Default.LogEvent(TraceEvent.Create(TraceEventType.Information, format, arguments)); + } + + [Conditional("TRACE")] + public static void TraceWarning(string format, params object[] arguments) { + LogChannel.Default.LogEvent(TraceEvent.Create(TraceEventType.Warning, format, arguments)); + } + + [Conditional("TRACE")] + public static void TraceError(string format, params object[] arguments) { + LogChannel.Default.LogEvent(TraceEvent.Create(TraceEventType.Error, format, arguments)); + } + + [Conditional("TRACE")] + public static void TraceError(Exception err) { + TraceError("{0}", err); + } + } +} diff --git a/Implab/Implab.csproj b/Implab/Implab.csproj --- a/Implab/Implab.csproj +++ b/Implab/Implab.csproj @@ -15,7 +15,7 @@ full false bin\Debug - DEBUG; + TRACE;DEBUG; prompt 4 false @@ -32,6 +32,13 @@ + + + + + + + @@ -43,7 +50,6 @@ - diff --git a/Implab/Parallels/AsyncPool.cs b/Implab/Parallels/AsyncPool.cs --- a/Implab/Parallels/AsyncPool.cs +++ b/Implab/Parallels/AsyncPool.cs @@ -1,3 +1,4 @@ +using Implab.Diagnostics; using System; using System.Threading; @@ -13,8 +14,10 @@ namespace Implab.Parallels { public static Promise Invoke(Func func) { var p = new Promise(); + var caller = TraceContext.Current; ThreadPool.QueueUserWorkItem(param => { + TraceLog.Transfer(caller); try { p.Resolve(func()); } catch(Exception e) { @@ -28,7 +31,10 @@ namespace Implab.Parallels { public static Promise InvokeNewThread(Func func) { var p = new Promise(); + var caller = TraceContext.Current; + var worker = new Thread(() => { + TraceLog.Transfer(caller); try { p.Resolve(func()); } catch (Exception e) { diff --git a/Implab/Parallels/WorkerPool.cs b/Implab/Parallels/WorkerPool.cs --- a/Implab/Parallels/WorkerPool.cs +++ b/Implab/Parallels/WorkerPool.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Diagnostics; +using Implab.Diagnostics; namespace Implab.Parallels { public class WorkerPool : DispatchPool { @@ -41,7 +42,10 @@ namespace Implab.Parallels { var promise = new Promise(); + var caller = TraceContext.Current; + EnqueueTask(delegate() { + TraceLog.Transfer(caller); try { promise.Resolve(task()); } catch (Exception e) { diff --git a/Implab/PromiseState.cs b/Implab/PromiseState.cs deleted file mode 100644 --- a/Implab/PromiseState.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Implab -{ - public enum PromiseState - { - Unresolved, - Resolved, - Cancelled, - Rejected - } -}