##// END OF EJS Templates
Improved logging
cin -
r134:04d4c92d0f28 v2
parent child
Show More
@@ -0,0 +1,8
1 using System;
2
3 namespace Implab.Diagnostics {
4 public interface ILogWriter<in TEvent> {
5 void Write(LogEventArgs args, TEvent entry);
6 }
7 }
8
@@ -0,0 +1,87
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace Implab.Diagnostics {
7 public abstract class ListenerBase : ServiceLocator, ILogWriter<object>, ILogWriter<TraceEvent> {
8
9 readonly Dictionary<object, Action> m_subscriptions = new Dictionary<object, Action>();
10
11 protected ListenerBase() {
12 Register(this);
13 }
14
15 public void Subscribe(Type eventType) {
16 if (eventType == null)
17 throw new ArgumentNullException("eventType");
18 GetType().GetMethod("Subscribe", new Type[0]).MakeGenericMethod(eventType).Invoke(this, null);
19 }
20
21 public void Subscribe<TEvent>() {
22 Subscribe<TEvent>(LogChannel<TEvent>.Default);
23 }
24
25 public void Subscribe<TEvent>(LogChannel<TEvent> channel) {
26 if (channel == null)
27 throw new ArgumentNullException("channel");
28
29 lock (m_subscriptions) {
30 AssertNotDisposed();
31 if (m_subscriptions.ContainsKey(channel))
32 return;
33
34 var writer = GetService<ILogWriter<TEvent>>();
35
36 EventHandler<LogEventArgs<TEvent>> handler = (sender, args) => writer.Write(args,args.Value);
37
38 channel.Events += handler;
39
40 Action unsubscribe = () => {
41 channel.Events -= handler;
42 };
43
44 m_subscriptions.Add(channel, unsubscribe);
45 }
46 }
47
48 public void Unsubscribe<TEvent>(LogChannel<TEvent> channel) {
49 if (channel == null)
50 throw new ArgumentNullException("channel");
51
52 lock (m_subscriptions) {
53 Action subscription;
54 if (m_subscriptions.TryGetValue(channel, out subscription)) {
55 subscription();
56 m_subscriptions.Remove(channel);
57 }
58 }
59 }
60
61 public void UnsubscribeAll() {
62 lock (m_subscriptions) {
63 foreach (var subscription in m_subscriptions.Values)
64 subscription();
65 m_subscriptions.Clear();
66 }
67 }
68
69 #region ILogWriter implementation
70 public abstract void Write(LogEventArgs args, object entry);
71 #endregion
72
73 #region ILogWriter implementation
74 public virtual void Write(LogEventArgs args, TraceEvent entry) {
75 Write(args, (object)entry);
76 }
77 #endregion
78
79
80 protected override void Dispose(bool disposing) {
81 base.Dispose(disposing);
82 if (disposing) {
83 UnsubscribeAll();
84 }
85 }
86 }
87 }
@@ -1,122 +1,122
1 using Implab.Parallels;
1 using Implab.Parallels;
2 using System;
2 using System;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using System.Linq;
4 using System.Linq;
5 using System.Text;
5 using System.Text;
6 using System.Threading;
6 using System.Threading;
7 using System.Threading.Tasks;
7 using System.Threading.Tasks;
8 using System.Windows.Forms;
8 using System.Windows.Forms;
9
9
10 namespace Implab.Diagnostics.Interactive
10 namespace Implab.Diagnostics.Interactive
11 {
11 {
12 public class InteractiveListener: TextListenerBase
12 public class InteractiveListener: ListenerBase
13 {
13 {
14 TraceForm m_form;
14 TraceForm m_form;
15
15
16 SynchronizationContext m_syncGuiThread;
16 SynchronizationContext m_syncGuiThread;
17 readonly Promise m_guiStarted = new Promise();
17 readonly Promise m_guiStarted = new Promise();
18
18
19 readonly IPromise m_guiFinished;
19 readonly IPromise m_guiFinished;
20 // readonly IPromise m_workerFinished = new Promise<object>();
20 // readonly IPromise m_workerFinished = new Promise<object>();
21
21
22 readonly MTQueue<TraceViewItem> m_queue = new MTQueue<TraceViewItem>();
22 readonly MTQueue<TraceViewItem> m_queue = new MTQueue<TraceViewItem>();
23 readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false);
23 readonly AutoResetEvent m_queueEvent = new AutoResetEvent(false);
24
24
25 int m_queueLength;
25 int m_queueLength;
26 bool m_exitPending;
26 bool m_exitPending;
27
27
28 readonly object m_pauseLock = new object();
28 readonly object m_pauseLock = new object();
29 bool m_paused;
29 bool m_paused;
30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
30 readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true);
31
31
32 public InteractiveListener(bool global) : base(global) {
32 public InteractiveListener() {
33 m_guiFinished = AsyncPool.RunThread(GuiThread);
33 m_guiFinished = AsyncPool.RunThread(GuiThread);
34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread);
34 /*m_workerFinished = */AsyncPool.RunThread(QueueThread);
35
35
36 m_guiStarted.Join();
36 m_guiStarted.Join();
37 }
37 }
38
38
39 void GuiThread() {
39 void GuiThread() {
40 m_form = new TraceForm(); // will create SynchronizationContext
40 m_form = new TraceForm(); // will create SynchronizationContext
41
41
42 m_form.PauseEvents += (s,a) => Pause();
42 m_form.PauseEvents += (s,a) => Pause();
43 m_form.ResumeEvents += (s, a) => Resume();
43 m_form.ResumeEvents += (s, a) => Resume();
44
44
45 m_syncGuiThread = SynchronizationContext.Current;
45 m_syncGuiThread = SynchronizationContext.Current;
46 m_guiStarted.Resolve();
46 m_guiStarted.Resolve();
47 Application.Run();
47 Application.Run();
48 }
48 }
49
49
50 void QueueThread() {
50 void QueueThread() {
51 while (!m_exitPending) {
51 while (!m_exitPending) {
52 if (m_paused)
52 if (m_paused)
53 m_pauseEvent.WaitOne();
53 m_pauseEvent.WaitOne();
54
54
55 TraceViewItem item;
55 TraceViewItem item;
56 if (m_queue.TryDequeue(out item)) {
56 if (m_queue.TryDequeue(out item)) {
57 Interlocked.Decrement(ref m_queueLength);
57 Interlocked.Decrement(ref m_queueLength);
58
58
59 m_syncGuiThread.Send(x => m_form.AddTraceEvent(item),null);
59 m_syncGuiThread.Send(x => m_form.AddTraceEvent(item),null);
60 } else {
60 } else {
61 m_queueEvent.WaitOne();
61 m_queueEvent.WaitOne();
62 }
62 }
63 }
63 }
64 }
64 }
65
65
66 public void Pause() {
66 public void Pause() {
67 // for consistency we need to set this properties atomically
67 // for consistency we need to set this properties atomically
68 lock (m_pauseLock) {
68 lock (m_pauseLock) {
69 m_pauseEvent.Reset();
69 m_pauseEvent.Reset();
70 m_paused = true;
70 m_paused = true;
71 }
71 }
72 }
72 }
73
73
74 public void Resume() {
74 public void Resume() {
75 // for consistency we need to set this properties atomically
75 // for consistency we need to set this properties atomically
76 lock (m_pauseLock) {
76 lock (m_pauseLock) {
77 m_paused = false;
77 m_paused = false;
78 m_pauseEvent.Set();
78 m_pauseEvent.Set();
79 }
79 }
80 }
80 }
81
81
82 void Enqueue(TraceViewItem item) {
82 void Enqueue(TraceViewItem item) {
83 m_queue.Enqueue(item);
83 m_queue.Enqueue(item);
84 if (Interlocked.Increment(ref m_queueLength) == 1)
84 if (Interlocked.Increment(ref m_queueLength) == 1)
85 m_queueEvent.Set();
85 m_queueEvent.Set();
86 }
86 }
87
87
88 public void ShowForm() {
88 public void ShowForm() {
89 m_syncGuiThread.Post(x => m_form.Show(), null);
89 m_syncGuiThread.Post(x => m_form.Show(), null);
90 }
90 }
91
91
92 public void HideForm() {
92 public void HideForm() {
93 m_syncGuiThread.Post(x => m_form.Hide(), null);
93 m_syncGuiThread.Post(x => m_form.Hide(), null);
94 }
94 }
95
95
96 void Terminate() {
96 void Terminate() {
97 m_exitPending = true;
97 m_exitPending = true;
98 Resume();
98 Resume();
99 m_syncGuiThread.Post(x => Application.ExitThread(), null);
99 m_syncGuiThread.Post(x => Application.ExitThread(), null);
100 }
100 }
101
101
102 protected override void Dispose(bool disposing) {
102 protected override void Dispose(bool disposing) {
103 if (disposing) {
103 if (disposing) {
104 Terminate();
104 Terminate();
105 m_guiFinished.Join();
105 m_guiFinished.Join();
106 }
106 }
107 base.Dispose(disposing);
107 base.Dispose(disposing);
108 }
108 }
109
109
110 protected override void WriteEntry(LogEventArgs args, EventText text, string channel) {
110 public override void Write(LogEventArgs args, object entry) {
111 var item = new TraceViewItem {
111 var item = new TraceViewItem {
112 Indent = text.indent,
112 Indent = args.Operation.Level,
113 Message = text.content,
113 Message = entry.ToString(),
114 Thread = args.ThreadId,
114 Thread = args.ThreadId,
115 Channel = channel,
115 Channel = args.ChannelName,
116 Timestamp = Environment.TickCount
116 Timestamp = Environment.TickCount
117 };
117 };
118
118
119 Enqueue(item);
119 Enqueue(item);
120 }
120 }
121 }
121 }
122 }
122 }
@@ -1,34 +1,22
1 using System;
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
2 using System.Text;
5
3
6 namespace Implab.Diagnostics {
4 namespace Implab.Diagnostics {
7 public class ConsoleTraceListener: TextListenerBase {
5 public class ConsoleTraceListener: ListenerBase {
8
6
9 static readonly object _consoleLock = new object();
7 static readonly object _consoleLock = new object();
10
8
11 public ConsoleTraceListener()
9 public override void Write(LogEventArgs args, object entry) {
12 : base(true) {
13
14 }
15
16 public ConsoleTraceListener(bool global)
17 : base(global) {
18
19 }
20
21 protected override void WriteEntry(LogEventArgs args, EventText text, string channel) {
22 var msg = new StringBuilder();
10 var msg = new StringBuilder();
23
11
24 for (int i = 0; i < text.indent; i++)
12 for (int i = 0; i < args.Operation.Level; i++)
25 msg.Append(" ");
13 msg.Append(" ");
26 msg.AppendFormat("[{0}]: {1}", args.ThreadId, text.content);
14 msg.AppendFormat("[{0}]: {1}", args.ThreadId, entry);
27
15
28 lock (_consoleLock) {
16 lock (_consoleLock) {
29 Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
17 Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
30 Console.WriteLine(msg);
18 Console.WriteLine(msg);
31 }
19 }
32 }
20 }
33 }
21 }
34 }
22 }
@@ -1,43 +1,41
1 using System;
1 namespace Implab.Diagnostics {
2
3 namespace Implab.Diagnostics {
4 public static class Extensions {
2 public static class Extensions {
5 public static IPromise<T> EndLogicalOperation<T>(this IPromise<T> promise) {
3 public static IPromise<T> EndLogicalOperation<T>(this IPromise<T> promise) {
6 Safe.ArgumentNotNull(promise, "promise");
4 Safe.ArgumentNotNull(promise, "promise");
7 var op = TraceContext.Instance.DetachLogicalOperation();
5 var op = TraceContext.Instance.DetachLogicalOperation();
8
6
9 return promise.On(
7 return promise.On(
10 x => {
8 x => {
11 TraceContext.Instance.EnterLogicalOperation(op,true);
9 TraceContext.Instance.EnterLogicalOperation(op,true);
12 TraceLog.TraceInformation("promise = {0}", x);
10 TraceLog.TraceInformation("promise = {0}", x);
13 TraceLog.EndLogicalOperation();
11 TraceLog.EndLogicalOperation();
14 TraceContext.Instance.Leave();
12 TraceContext.Instance.Leave();
15 },
13 },
16 err =>{
14 err =>{
17 TraceContext.Instance.EnterLogicalOperation(op,true);
15 TraceContext.Instance.EnterLogicalOperation(op,true);
18 TraceLog.TraceError("promise died {0}", err);
16 TraceLog.TraceError("promise died {0}", err);
19 TraceLog.EndLogicalOperation();
17 TraceLog.EndLogicalOperation();
20 TraceContext.Instance.Leave();
18 TraceContext.Instance.Leave();
21 },
19 },
22 () => {
20 () => {
23 TraceContext.Instance.EnterLogicalOperation(op,true);
21 TraceContext.Instance.EnterLogicalOperation(op,true);
24 TraceLog.TraceInformation("promise cancelled");
22 TraceLog.TraceInformation("promise cancelled");
25 TraceLog.EndLogicalOperation();
23 TraceLog.EndLogicalOperation();
26 TraceContext.Instance.Leave();
24 TraceContext.Instance.Leave();
27 }
25 }
28 );
26 );
29 }
27 }
30
28
31 public static IPromise EndLogicalOperation(this IPromise promise) {
29 public static IPromise EndLogicalOperation(this IPromise promise) {
32 Safe.ArgumentNotNull(promise, "promise");
30 Safe.ArgumentNotNull(promise, "promise");
33 var op = TraceContext.Instance.DetachLogicalOperation();
31 var op = TraceContext.Instance.DetachLogicalOperation();
34
32
35 return promise.On(() => {
33 return promise.On(() => {
36 TraceContext.Instance.EnterLogicalOperation(op,true);
34 TraceContext.Instance.EnterLogicalOperation(op,true);
37 TraceLog.EndLogicalOperation();
35 TraceLog.EndLogicalOperation();
38 TraceContext.Instance.Leave();
36 TraceContext.Instance.Leave();
39 }, PromiseEventType.All);
37 }, PromiseEventType.All);
40 }
38 }
41 }
39 }
42 }
40 }
43
41
@@ -1,80 +1,81
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using System.Linq;
3 using System.Linq;
4 using System.Text;
4 using System.Text;
5
5
6 namespace Implab.Diagnostics {
6 namespace Implab.Diagnostics {
7 /// <summary>
7 /// <summary>
8 /// Канал, через который публикуются события журнала.
8 /// Канал, через который публикуются события журнала.
9 /// </summary>
9 /// </summary>
10 /// <typeparam name="TEvent">Тип событий в канале</typeparam>
10 /// <typeparam name="TEvent">Тип событий в канале</typeparam>
11 /// <remarks>
11 /// <remarks>
12 /// Событиями журнала могут быть любые типы, например строки, в которых будет передаваться
12 /// Событиями журнала могут быть любые типы, например строки, в которых будет передаваться
13 /// информация, или структуры с набором полей, описывающих важность, текст и другую информацию.
13 /// информация, или структуры с набором полей, описывающих важность, текст и другую информацию.
14 /// </remarks>
14 /// </remarks>
15 public class LogChannel<TEvent> {
15 public class LogChannel<TEvent> {
16 static LogChannel<TEvent> _default = new LogChannel<TEvent>();
16 static LogChannel<TEvent> _default = new LogChannel<TEvent>();
17
17
18 /// <summary>
18 /// <summary>
19 /// Канал по-умолчанию для событий типа <typeparam name="TEvent"/>.
19 /// Канал по-умолчанию для событий типа <typeparam name="TEvent"/>.
20 /// </summary>
20 /// </summary>
21 public static LogChannel<TEvent> Default {
21 public static LogChannel<TEvent> Default {
22 get {
22 get {
23 return _default;
23 return _default;
24 }
24 }
25 }
25 }
26
26
27 /// <summary>
27 /// <summary>
28 /// Событие появление новой записи в журнале, на это событие подписываются слушатели.
28 /// Событие появление новой записи в журнале, на это событие подписываются слушатели.
29 /// </summary>
29 /// </summary>
30 public event EventHandler<LogEventArgs<TEvent>> Events;
30 public event EventHandler<LogEventArgs<TEvent>> Events;
31
31
32 /// <summary>
32 /// <summary>
33 /// Имя канала, полезно для отображения в журнале
33 /// Имя канала, полезно для отображения в журнале
34 /// </summary>
34 /// </summary>
35 public string Name {
35 public string Name {
36 get;
36 get;
37 private set;
37 private set;
38 }
38 }
39
39
40 /// <summary>
40 /// <summary>
41 /// Создает журнал, имя типа событий назначается в качетве имени канала.
41 /// Создает журнал, имя типа событий назначается в качетве имени канала.
42 /// </summary>
42 /// </summary>
43 public LogChannel()
43 public LogChannel()
44 : this(null) {
44 : this(null) {
45 }
45 }
46
46
47 /// <summary>
47 /// <summary>
48 /// Содает канал с указанным именем.
48 /// Содает канал с указанным именем.
49 /// </summary>
49 /// </summary>
50 /// <param name="name">Имя канала.</param>
50 /// <param name="name">Имя канала.</param>
51 public LogChannel(string name) {
51 public LogChannel(string name) {
52 if (String.IsNullOrEmpty(name))
52 if (String.IsNullOrEmpty(name))
53 name = typeof(TEvent).Name;
53 name = typeof(TEvent).Name;
54 Name = name;
54 Name = name;
55 }
55 }
56
56
57 /// <summary>
57 /// <summary>
58 /// Отправляет запись журнала через канал подписчикам.
58 /// Отправляет запись журнала через канал подписчикам.
59 /// </summary>
59 /// </summary>
60 /// <param name="data">Запись журнала.</param>
60 /// <param name="data">Запись журнала.</param>
61 /// <remarks>
61 /// <remarks>
62 /// Контекст трассировки от которого рассылается сообщение определяется автоматически из текущего потока.
62 /// Контекст трассировки от которого рассылается сообщение определяется автоматически из текущего потока.
63 /// </remarks>
63 /// </remarks>
64 public void LogEvent(TEvent data) {
64 public void LogEvent(TEvent data) {
65 var t = Events;
65 var t = Events;
66 if (t != null) {
66 if (t != null) {
67 var traceContext = TraceContext.Instance;
67 var traceContext = TraceContext.Instance;
68 t(
68 t(
69 this,
69 this,
70 new LogEventArgs<TEvent>(
70 new LogEventArgs<TEvent>(
71 data,
71 data,
72 Name,
72 traceContext.ThreadId,
73 traceContext.ThreadId,
73 traceContext.CurrentOperation,
74 traceContext.CurrentOperation,
74 traceContext.CurrentOperation.Duration
75 traceContext.CurrentOperation.Duration
75 )
76 )
76 );
77 );
77 }
78 }
78 }
79 }
79 }
80 }
80 }
81 }
@@ -1,24 +1,29
1 using System;
1 using System;
2
2
3 namespace Implab.Diagnostics {
3 namespace Implab.Diagnostics {
4 public class LogEventArgs : EventArgs {
4 public class LogEventArgs : EventArgs {
5 public string ChannelName {
6 get;
7 private set;
8 }
5 public int ThreadId {
9 public int ThreadId {
6 get;
10 get;
7 private set;
11 private set;
8 }
12 }
9 public LogicalOperation Operation {
13 public LogicalOperation Operation {
10 get;
14 get;
11 private set;
15 private set;
12 }
16 }
13 public int OperationTimeOffset {
17 public int OperationTimeOffset {
14 get;
18 get;
15 private set;
19 private set;
16 }
20 }
17 public LogEventArgs(int threadId, LogicalOperation operation, int timeOffset) {
21 public LogEventArgs(string channelName, int threadId, LogicalOperation operation, int timeOffset) {
22 ChannelName = channelName;
18 ThreadId = threadId;
23 ThreadId = threadId;
19 Operation = operation;
24 Operation = operation;
20 OperationTimeOffset = timeOffset;
25 OperationTimeOffset = timeOffset;
21 }
26 }
22 }
27 }
23 }
28 }
24
29
@@ -1,13 +1,13
1 namespace Implab.Diagnostics {
1 namespace Implab.Diagnostics {
2 public class LogEventArgs<TEvent> : LogEventArgs {
2 public class LogEventArgs<TEvent> : LogEventArgs {
3 public TEvent Value {
3 public TEvent Value {
4 get;
4 get;
5 private set;
5 private set;
6 }
6 }
7
7
8 public LogEventArgs(TEvent value, int threadId, LogicalOperation operation, int timeOffset) : base(threadId, operation, timeOffset) {
8 public LogEventArgs(TEvent value,string channelName, int threadId, LogicalOperation operation, int timeOffset) : base(channelName, threadId, operation, timeOffset) {
9 Value = value;
9 Value = value;
10 }
10 }
11 }
11 }
12 }
12 }
13
13
@@ -1,59 +1,65
1 namespace Implab.Diagnostics {
1 namespace Implab.Diagnostics {
2 struct OperationContext {
2 struct OperationContext {
3 readonly LogicalOperation m_initial;
4 public readonly static OperationContext EMPTY = new OperationContext(LogicalOperation.EMPTY, false);
3 public readonly static OperationContext EMPTY = new OperationContext(LogicalOperation.EMPTY, false);
4
5 LogicalOperation m_initial;
5 LogicalOperation m_current;
6 LogicalOperation m_current;
6 readonly bool m_ownership;
7 bool m_ownership;
7
8
8 public OperationContext(LogicalOperation operation, bool ownership) {
9 public OperationContext(LogicalOperation operation, bool ownership) {
9 Safe.ArgumentNotNull(operation, "operation");
10 Safe.ArgumentNotNull(operation, "operation");
10
11
11 m_initial = operation;
12 m_initial = operation;
12 m_current = operation;
13 m_current = operation;
13 m_ownership = ownership;
14 m_ownership = ownership;
14 }
15 }
15
16
16 public LogicalOperation CurrentOperation {
17 public LogicalOperation CurrentOperation {
17 get { return m_current; }
18 get { return m_current; }
18 }
19 }
19
20
20 public void BeginLogicalOperation(string name) {
21 public void BeginLogicalOperation(string name) {
21 m_current = new LogicalOperation(name, m_current);
22 m_current = new LogicalOperation(name, m_current);
22 }
23 }
23
24
24 public LogicalOperation DetachLogicalOperation() {
25 public LogicalOperation DetachLogicalOperation() {
25 var detached = m_current;
26 var detached = m_current;
26 if (m_current != LogicalOperation.EMPTY) {
27 if (m_current != LogicalOperation.EMPTY) {
27 if (m_current != m_initial)
28 if (m_current != m_initial)
28 m_current = m_current.Parent;
29 m_current = m_current.Parent;
29 else if (m_ownership)
30 else if (m_ownership)
30 m_current = LogicalOperation.EMPTY;
31 m_current = LogicalOperation.EMPTY;
31 else {
32 else {
32 TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context");
33 TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context");
33 detached = LogicalOperation.EMPTY;
34 detached = LogicalOperation.EMPTY;
34 }
35 }
35 } else {
36 } else {
36 TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context");
37 TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context");
37 }
38 }
38
39
39 return detached;
40 return detached;
40 }
41 }
41
42
42 public void EndLogicalOperation() {
43 public LogicalOperation EndLogicalOperation() {
43 if (m_current != m_initial) {
44 var current = m_current;
45 if (m_current != LogicalOperation.EMPTY && (m_current != m_initial || m_ownership)) {
44 m_current = m_current.Parent;
46 m_current = m_current.Parent;
45 } else if (m_current != LogicalOperation.EMPTY && m_ownership) {
47 if (current == m_initial) {
46 m_current = LogicalOperation.EMPTY;
48 // we have complete the owned operation
49 m_initial = m_current;
50 m_ownership = false;
51 }
47 } else {
52 } else {
48 TraceLog.TraceWarning("EndLogicalOperation can't be applied in the current context");
53 TraceLog.TraceWarning("EndLogicalOperation can't be applied in the current context");
49 }
54 }
55 return current;
50 }
56 }
51
57
52 public void Leave() {
58 public void Leave() {
53
59
54 if ((m_ownership && m_current != LogicalOperation.EMPTY) || (!m_ownership && m_current != m_initial) )
60 if ((m_ownership && m_current != LogicalOperation.EMPTY) || (!m_ownership && m_current != m_initial) )
55 TraceLog.TraceWarning("Trying to leave unfinished logical operation {0}", m_current.Name);
61 TraceLog.TraceWarning("Trying to leave unfinished logical operation {0}", m_current.Name);
56 }
62 }
57 }
63 }
58 }
64 }
59
65
@@ -1,45 +1,46
1 using System;
1 using System;
2 using System.IO;
2 using System.IO;
3 using System.Text;
3 using System.Text;
4
4
5 namespace Implab.Diagnostics {
5 namespace Implab.Diagnostics {
6 public class TextFileListener: TextListenerBase {
6 public class TextFileListener: ListenerBase {
7 readonly TextWriter m_textWriter;
7 readonly TextWriter m_textWriter;
8
8
9 public TextFileListener(string fileName, bool global)
9 public TextFileListener(string fileName) {
10 : base(global) {
11 m_textWriter = File.CreateText(fileName);
10 m_textWriter = File.CreateText(fileName);
12
11
13 m_textWriter.WriteLine("LOG {0}", DateTime.Now);
12 m_textWriter.WriteLine("LOG {0}", DateTime.Now);
14 Register(this);
15 }
13 }
16
14
17 protected override void WriteEntry(LogEventArgs args, EventText text, string channel) {
15 #region implemented abstract members of ListenerBase
16
17 public override void Write(LogEventArgs args, object entry) {
18 var msg = new StringBuilder();
18 var msg = new StringBuilder();
19 for (int i = 0; i < text.indent; i++)
19 for (int i = 0; i < args.Operation.Level; i++)
20 msg.Append(" ");
20 msg.Append(" ");
21 msg.AppendFormat("[{0}]:{1}: {2}", args.ThreadId, channel, text.content);
21 msg.AppendFormat("[{0}]:{1}: {2}", args.ThreadId, args.ChannelName, entry);
22
22
23 lock (m_textWriter) {
23 lock (m_textWriter) {
24 if (!IsDisposed) {
24 if (!IsDisposed) {
25 // тут гарантировано еще не освобожден m_textWriter
25 // тут гарантировано еще не освобожден m_textWriter
26 m_textWriter.WriteLine(msg);
26 m_textWriter.WriteLine(msg);
27 m_textWriter.Flush();
27 m_textWriter.Flush();
28 }
28 }
29 }
29 }
30 }
30 }
31
31
32 #endregion
32
33
33 protected override void Dispose(bool disposing) {
34 protected override void Dispose(bool disposing) {
34 base.Dispose(disposing);
35 base.Dispose(disposing);
35 if (disposing) {
36 if (disposing) {
36 // IsDisposed = true
37 // IsDisposed = true
37 lock (m_textWriter) {
38 lock (m_textWriter) {
38 Safe.Dispose(m_textWriter);
39 Safe.Dispose(m_textWriter);
39 }
40 }
40 }
41 }
41 }
42 }
42
43
43
44
44 }
45 }
45 }
46 }
@@ -1,83 +1,83
1 using System;
1 using System;
2 using System.Collections.Generic;
2 using System.Collections.Generic;
3 using System.Threading;
3 using System.Threading;
4
4
5 namespace Implab.Diagnostics {
5 namespace Implab.Diagnostics {
6 /// <summary>
6 /// <summary>
7 /// Trace context is bound to the specific thread, each thread has it's own ThreadContext.
7 /// Trace context is bound to the specific thread, each thread has it's own ThreadContext.
8 /// </summary>
8 /// </summary>
9 /// <remarks>
9 /// <remarks>
10 /// ThreadContext manages relations between logical operations and threads.
10 /// ThreadContext manages relations between logical operations and threads.
11 /// </remarks>
11 /// </remarks>
12 public class TraceContext {
12 public class TraceContext {
13
13
14 [ThreadStatic]
14 [ThreadStatic]
15 static TraceContext _instance;
15 static TraceContext _instance;
16
16
17 OperationContext m_current = OperationContext.EMPTY;
17 OperationContext m_current = OperationContext.EMPTY;
18 readonly Stack<OperationContext> m_stack = new Stack<OperationContext>();
18 readonly Stack<OperationContext> m_stack = new Stack<OperationContext>();
19 readonly int m_threadId;
19 readonly int m_threadId;
20
20
21 public static TraceContext Instance {
21 public static TraceContext Instance {
22 get {
22 get {
23 if (_instance == null)
23 if (_instance == null)
24 _instance = new TraceContext();
24 _instance = new TraceContext();
25 return _instance;
25 return _instance;
26 }
26 }
27 }
27 }
28
28
29 public TraceContext() {
29 public TraceContext() {
30 m_threadId = Thread.CurrentThread.ManagedThreadId;
30 m_threadId = Thread.CurrentThread.ManagedThreadId;
31 }
31 }
32
32
33 public int ThreadId {
33 public int ThreadId {
34 get { return m_threadId; }
34 get { return m_threadId; }
35 }
35 }
36
36
37 public LogicalOperation CurrentOperation {
37 public LogicalOperation CurrentOperation {
38 get {
38 get {
39 return m_current.CurrentOperation;
39 return m_current.CurrentOperation;
40 }
40 }
41 }
41 }
42
42
43 public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) {
43 public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) {
44 //var prev = CurrentOperation;
44 //var prev = CurrentOperation;
45 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name)));
45 m_stack.Push(m_current);
46 m_stack.Push(m_current);
46 m_current = new OperationContext(operation, takeOwnership);
47 m_current = new OperationContext(operation, takeOwnership);
47 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name)));
48 }
48 }
49
49
50 public void StartLogicalOperation(string name) {
50 public void StartLogicalOperation(string name) {
51 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, name));
51 m_current.BeginLogicalOperation(name);
52 m_current.BeginLogicalOperation(name);
52 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, String.Format("+{0}",CurrentOperation.Name)));
53 }
53 }
54
54
55 public void StartLogicalOperation() {
55 public void StartLogicalOperation() {
56 StartLogicalOperation(String.Empty);
56 StartLogicalOperation(String.Empty);
57 }
57 }
58
58
59 public void EndLogicalOperation() {
59 public void EndLogicalOperation() {
60 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",CurrentOperation.Name, CurrentOperation.Duration)));
60 var op = m_current.EndLogicalOperation();
61 m_current.EndLogicalOperation();
61 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",op.Name, op.Duration)));
62 }
62 }
63
63
64 public LogicalOperation DetachLogicalOperation() {
64 public LogicalOperation DetachLogicalOperation() {
65 var prev = m_current.DetachLogicalOperation();
65 var prev = m_current.DetachLogicalOperation();
66 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("{0} -> {1}",prev.Name, CurrentOperation.Name)));
66 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("{0} -> {1}",prev.Name, CurrentOperation.Name)));
67 return prev;
67 return prev;
68 }
68 }
69
69
70 public void Leave() {
70 public void Leave() {
71 if (m_stack.Count > 0) {
71 if (m_stack.Count > 0) {
72 m_current.Leave();
72 m_current.Leave();
73 //var prev = CurrentOperation;
73 //var prev = CurrentOperation;
74 m_current = m_stack.Pop();
74 m_current = m_stack.Pop();
75 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Leave, String.Format("{0} -> {1}", prev.Name, CurrentOperation.Name)));
75 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Leave, String.Format("{0} -> {1}", prev.Name, CurrentOperation.Name)));
76 } else {
76 } else {
77 TraceLog.TraceWarning("Attempt to leave the last operation context");
77 TraceLog.TraceWarning("Attempt to leave the last operation context");
78 m_current = OperationContext.EMPTY;
78 m_current = OperationContext.EMPTY;
79 }
79 }
80 }
80 }
81 }
81 }
82 }
82 }
83
83
@@ -1,230 +1,230
1 <?xml version="1.0" encoding="utf-8"?>
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid>
6 <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid>
7 <OutputType>Library</OutputType>
7 <OutputType>Library</OutputType>
8 <RootNamespace>Implab</RootNamespace>
8 <RootNamespace>Implab</RootNamespace>
9 <AssemblyName>Implab</AssemblyName>
9 <AssemblyName>Implab</AssemblyName>
10 </PropertyGroup>
10 </PropertyGroup>
11 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
11 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
12 <DebugSymbols>true</DebugSymbols>
12 <DebugSymbols>true</DebugSymbols>
13 <DebugType>full</DebugType>
13 <DebugType>full</DebugType>
14 <Optimize>false</Optimize>
14 <Optimize>false</Optimize>
15 <OutputPath>bin\Debug</OutputPath>
15 <OutputPath>bin\Debug</OutputPath>
16 <DefineConstants>TRACE;DEBUG;</DefineConstants>
16 <DefineConstants>TRACE;DEBUG;</DefineConstants>
17 <ErrorReport>prompt</ErrorReport>
17 <ErrorReport>prompt</ErrorReport>
18 <WarningLevel>4</WarningLevel>
18 <WarningLevel>4</WarningLevel>
19 <ConsolePause>false</ConsolePause>
19 <ConsolePause>false</ConsolePause>
20 <RunCodeAnalysis>true</RunCodeAnalysis>
20 <RunCodeAnalysis>true</RunCodeAnalysis>
21 </PropertyGroup>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>full</DebugType>
23 <DebugType>full</DebugType>
24 <Optimize>true</Optimize>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release</OutputPath>
25 <OutputPath>bin\Release</OutputPath>
26 <ErrorReport>prompt</ErrorReport>
26 <ErrorReport>prompt</ErrorReport>
27 <WarningLevel>4</WarningLevel>
27 <WarningLevel>4</WarningLevel>
28 <ConsolePause>false</ConsolePause>
28 <ConsolePause>false</ConsolePause>
29 </PropertyGroup>
29 </PropertyGroup>
30 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
30 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
31 <DebugSymbols>true</DebugSymbols>
31 <DebugSymbols>true</DebugSymbols>
32 <DebugType>full</DebugType>
32 <DebugType>full</DebugType>
33 <Optimize>false</Optimize>
33 <Optimize>false</Optimize>
34 <OutputPath>bin\Debug</OutputPath>
34 <OutputPath>bin\Debug</OutputPath>
35 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
35 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
36 <ErrorReport>prompt</ErrorReport>
36 <ErrorReport>prompt</ErrorReport>
37 <WarningLevel>4</WarningLevel>
37 <WarningLevel>4</WarningLevel>
38 <RunCodeAnalysis>true</RunCodeAnalysis>
38 <RunCodeAnalysis>true</RunCodeAnalysis>
39 <ConsolePause>false</ConsolePause>
39 <ConsolePause>false</ConsolePause>
40 </PropertyGroup>
40 </PropertyGroup>
41 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
41 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
42 <Optimize>true</Optimize>
42 <Optimize>true</Optimize>
43 <OutputPath>bin\Release</OutputPath>
43 <OutputPath>bin\Release</OutputPath>
44 <ErrorReport>prompt</ErrorReport>
44 <ErrorReport>prompt</ErrorReport>
45 <WarningLevel>4</WarningLevel>
45 <WarningLevel>4</WarningLevel>
46 <ConsolePause>false</ConsolePause>
46 <ConsolePause>false</ConsolePause>
47 <DefineConstants>NET_4_5</DefineConstants>
47 <DefineConstants>NET_4_5</DefineConstants>
48 </PropertyGroup>
48 </PropertyGroup>
49 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
49 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
50 <DebugSymbols>true</DebugSymbols>
50 <DebugSymbols>true</DebugSymbols>
51 <DebugType>full</DebugType>
51 <DebugType>full</DebugType>
52 <Optimize>false</Optimize>
52 <Optimize>false</Optimize>
53 <OutputPath>bin\Debug</OutputPath>
53 <OutputPath>bin\Debug</OutputPath>
54 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
54 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
55 <ErrorReport>prompt</ErrorReport>
55 <ErrorReport>prompt</ErrorReport>
56 <WarningLevel>4</WarningLevel>
56 <WarningLevel>4</WarningLevel>
57 <RunCodeAnalysis>true</RunCodeAnalysis>
57 <RunCodeAnalysis>true</RunCodeAnalysis>
58 <ConsolePause>false</ConsolePause>
58 <ConsolePause>false</ConsolePause>
59 </PropertyGroup>
59 </PropertyGroup>
60 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
60 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
61 <Optimize>true</Optimize>
61 <Optimize>true</Optimize>
62 <OutputPath>bin\Release</OutputPath>
62 <OutputPath>bin\Release</OutputPath>
63 <DefineConstants>NET_4_5;MONO;</DefineConstants>
63 <DefineConstants>NET_4_5;MONO;</DefineConstants>
64 <ErrorReport>prompt</ErrorReport>
64 <ErrorReport>prompt</ErrorReport>
65 <WarningLevel>4</WarningLevel>
65 <WarningLevel>4</WarningLevel>
66 <ConsolePause>false</ConsolePause>
66 <ConsolePause>false</ConsolePause>
67 </PropertyGroup>
67 </PropertyGroup>
68 <ItemGroup>
68 <ItemGroup>
69 <Reference Include="System" />
69 <Reference Include="System" />
70 <Reference Include="System.Xml" />
70 <Reference Include="System.Xml" />
71 </ItemGroup>
71 </ItemGroup>
72 <ItemGroup>
72 <ItemGroup>
73 <Compile Include="Component.cs" />
73 <Compile Include="Component.cs" />
74 <Compile Include="CustomEqualityComparer.cs" />
74 <Compile Include="CustomEqualityComparer.cs" />
75 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
75 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
76 <Compile Include="Diagnostics\EventText.cs" />
76 <Compile Include="Diagnostics\EventText.cs" />
77 <Compile Include="Diagnostics\IEventTextFormatter.cs" />
78 <Compile Include="Diagnostics\LogChannel.cs" />
77 <Compile Include="Diagnostics\LogChannel.cs" />
79 <Compile Include="Diagnostics\LogicalOperation.cs" />
78 <Compile Include="Diagnostics\LogicalOperation.cs" />
80 <Compile Include="Diagnostics\TextFileListener.cs" />
79 <Compile Include="Diagnostics\TextFileListener.cs" />
81 <Compile Include="Diagnostics\TextListenerBase.cs" />
82 <Compile Include="Diagnostics\TraceLog.cs" />
80 <Compile Include="Diagnostics\TraceLog.cs" />
83 <Compile Include="Diagnostics\TraceEvent.cs" />
81 <Compile Include="Diagnostics\TraceEvent.cs" />
84 <Compile Include="Diagnostics\TraceEventType.cs" />
82 <Compile Include="Diagnostics\TraceEventType.cs" />
85 <Compile Include="Disposable.cs" />
83 <Compile Include="Disposable.cs" />
86 <Compile Include="ICancellable.cs" />
84 <Compile Include="ICancellable.cs" />
87 <Compile Include="IProgressHandler.cs" />
85 <Compile Include="IProgressHandler.cs" />
88 <Compile Include="IProgressNotifier.cs" />
86 <Compile Include="IProgressNotifier.cs" />
89 <Compile Include="IPromiseT.cs" />
87 <Compile Include="IPromiseT.cs" />
90 <Compile Include="IPromise.cs" />
88 <Compile Include="IPromise.cs" />
91 <Compile Include="IServiceLocator.cs" />
89 <Compile Include="IServiceLocator.cs" />
92 <Compile Include="ITaskController.cs" />
90 <Compile Include="ITaskController.cs" />
93 <Compile Include="JSON\JSONElementContext.cs" />
91 <Compile Include="JSON\JSONElementContext.cs" />
94 <Compile Include="JSON\JSONElementType.cs" />
92 <Compile Include="JSON\JSONElementType.cs" />
95 <Compile Include="JSON\JSONGrammar.cs" />
93 <Compile Include="JSON\JSONGrammar.cs" />
96 <Compile Include="JSON\JSONParser.cs" />
94 <Compile Include="JSON\JSONParser.cs" />
97 <Compile Include="JSON\JSONScanner.cs" />
95 <Compile Include="JSON\JSONScanner.cs" />
98 <Compile Include="JSON\JsonTokenType.cs" />
96 <Compile Include="JSON\JsonTokenType.cs" />
99 <Compile Include="JSON\JSONWriter.cs" />
97 <Compile Include="JSON\JSONWriter.cs" />
100 <Compile Include="JSON\JSONXmlReader.cs" />
98 <Compile Include="JSON\JSONXmlReader.cs" />
101 <Compile Include="JSON\JSONXmlReaderOptions.cs" />
99 <Compile Include="JSON\JSONXmlReaderOptions.cs" />
102 <Compile Include="JSON\StringTranslator.cs" />
100 <Compile Include="JSON\StringTranslator.cs" />
103 <Compile Include="Parallels\DispatchPool.cs" />
101 <Compile Include="Parallels\DispatchPool.cs" />
104 <Compile Include="Parallels\ArrayTraits.cs" />
102 <Compile Include="Parallels\ArrayTraits.cs" />
105 <Compile Include="Parallels\MTQueue.cs" />
103 <Compile Include="Parallels\MTQueue.cs" />
106 <Compile Include="Parallels\WorkerPool.cs" />
104 <Compile Include="Parallels\WorkerPool.cs" />
107 <Compile Include="Parsing\Alphabet.cs" />
105 <Compile Include="Parsing\Alphabet.cs" />
108 <Compile Include="Parsing\AlphabetBase.cs" />
106 <Compile Include="Parsing\AlphabetBase.cs" />
109 <Compile Include="Parsing\AltToken.cs" />
107 <Compile Include="Parsing\AltToken.cs" />
110 <Compile Include="Parsing\BinaryToken.cs" />
108 <Compile Include="Parsing\BinaryToken.cs" />
111 <Compile Include="Parsing\CatToken.cs" />
109 <Compile Include="Parsing\CatToken.cs" />
112 <Compile Include="Parsing\CDFADefinition.cs" />
110 <Compile Include="Parsing\CDFADefinition.cs" />
113 <Compile Include="Parsing\DFABuilder.cs" />
111 <Compile Include="Parsing\DFABuilder.cs" />
114 <Compile Include="Parsing\DFADefinitionBase.cs" />
112 <Compile Include="Parsing\DFADefinitionBase.cs" />
115 <Compile Include="Parsing\DFAStateDescriptor.cs" />
113 <Compile Include="Parsing\DFAStateDescriptor.cs" />
116 <Compile Include="Parsing\DFAutomaton.cs" />
114 <Compile Include="Parsing\DFAutomaton.cs" />
117 <Compile Include="Parsing\EDFADefinition.cs" />
115 <Compile Include="Parsing\EDFADefinition.cs" />
118 <Compile Include="Parsing\EmptyToken.cs" />
116 <Compile Include="Parsing\EmptyToken.cs" />
119 <Compile Include="Parsing\EndToken.cs" />
117 <Compile Include="Parsing\EndToken.cs" />
120 <Compile Include="Parsing\EnumAlphabet.cs" />
118 <Compile Include="Parsing\EnumAlphabet.cs" />
121 <Compile Include="Parsing\Grammar.cs" />
119 <Compile Include="Parsing\Grammar.cs" />
122 <Compile Include="Parsing\IAlphabet.cs" />
120 <Compile Include="Parsing\IAlphabet.cs" />
123 <Compile Include="Parsing\IDFADefinition.cs" />
121 <Compile Include="Parsing\IDFADefinition.cs" />
124 <Compile Include="Parsing\IVisitor.cs" />
122 <Compile Include="Parsing\IVisitor.cs" />
125 <Compile Include="Parsing\ParserException.cs" />
123 <Compile Include="Parsing\ParserException.cs" />
126 <Compile Include="Parsing\Scanner.cs" />
124 <Compile Include="Parsing\Scanner.cs" />
127 <Compile Include="Parsing\StarToken.cs" />
125 <Compile Include="Parsing\StarToken.cs" />
128 <Compile Include="Parsing\SymbolToken.cs" />
126 <Compile Include="Parsing\SymbolToken.cs" />
129 <Compile Include="Parsing\Token.cs" />
127 <Compile Include="Parsing\Token.cs" />
130 <Compile Include="ServiceLocator.cs" />
128 <Compile Include="ServiceLocator.cs" />
131 <Compile Include="TaskController.cs" />
129 <Compile Include="TaskController.cs" />
132 <Compile Include="ProgressInitEventArgs.cs" />
130 <Compile Include="ProgressInitEventArgs.cs" />
133 <Compile Include="Properties\AssemblyInfo.cs" />
131 <Compile Include="Properties\AssemblyInfo.cs" />
134 <Compile Include="Parallels\AsyncPool.cs" />
132 <Compile Include="Parallels\AsyncPool.cs" />
135 <Compile Include="Safe.cs" />
133 <Compile Include="Safe.cs" />
136 <Compile Include="ValueEventArgs.cs" />
134 <Compile Include="ValueEventArgs.cs" />
137 <Compile Include="PromiseExtensions.cs" />
135 <Compile Include="PromiseExtensions.cs" />
138 <Compile Include="SyncContextPromise.cs" />
136 <Compile Include="SyncContextPromise.cs" />
139 <Compile Include="Diagnostics\OperationContext.cs" />
137 <Compile Include="Diagnostics\OperationContext.cs" />
140 <Compile Include="Diagnostics\TraceContext.cs" />
138 <Compile Include="Diagnostics\TraceContext.cs" />
141 <Compile Include="Diagnostics\LogEventArgs.cs" />
139 <Compile Include="Diagnostics\LogEventArgs.cs" />
142 <Compile Include="Diagnostics\LogEventArgsT.cs" />
140 <Compile Include="Diagnostics\LogEventArgsT.cs" />
143 <Compile Include="Diagnostics\Extensions.cs" />
141 <Compile Include="Diagnostics\Extensions.cs" />
144 <Compile Include="IComponentContainer.cs" />
142 <Compile Include="IComponentContainer.cs" />
145 <Compile Include="PromiseEventType.cs" />
143 <Compile Include="PromiseEventType.cs" />
146 <Compile Include="ComponentContainer.cs" />
144 <Compile Include="ComponentContainer.cs" />
147 <Compile Include="DisposablePool.cs" />
145 <Compile Include="DisposablePool.cs" />
148 <Compile Include="ObjectPool.cs" />
146 <Compile Include="ObjectPool.cs" />
149 <Compile Include="Parallels\AsyncQueue.cs" />
147 <Compile Include="Parallels\AsyncQueue.cs" />
150 <Compile Include="PromiseT.cs" />
148 <Compile Include="PromiseT.cs" />
151 <Compile Include="IDeferred.cs" />
149 <Compile Include="IDeferred.cs" />
152 <Compile Include="IDeferredT.cs" />
150 <Compile Include="IDeferredT.cs" />
153 <Compile Include="AbstractPromise.cs" />
151 <Compile Include="AbstractPromise.cs" />
154 <Compile Include="Promise.cs" />
152 <Compile Include="Promise.cs" />
155 <Compile Include="PromiseTransientException.cs" />
153 <Compile Include="PromiseTransientException.cs" />
156 <Compile Include="Parallels\Signal.cs" />
154 <Compile Include="Parallels\Signal.cs" />
157 <Compile Include="Parallels\SharedLock.cs" />
155 <Compile Include="Parallels\SharedLock.cs" />
156 <Compile Include="Diagnostics\ILogWriter.cs" />
157 <Compile Include="Diagnostics\ListenerBase.cs" />
158 </ItemGroup>
158 </ItemGroup>
159 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
159 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
160 <ItemGroup />
160 <ItemGroup />
161 <ProjectExtensions>
161 <ProjectExtensions>
162 <MonoDevelop>
162 <MonoDevelop>
163 <Properties>
163 <Properties>
164 <Policies>
164 <Policies>
165 <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
165 <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
166 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
166 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
167 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
167 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
168 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
168 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
169 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
169 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
170 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
170 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
171 <NameConventionPolicy>
171 <NameConventionPolicy>
172 <Rules>
172 <Rules>
173 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
173 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
174 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
174 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
175 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
175 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
176 <RequiredPrefixes>
176 <RequiredPrefixes>
177 <String>I</String>
177 <String>I</String>
178 </RequiredPrefixes>
178 </RequiredPrefixes>
179 </NamingRule>
179 </NamingRule>
180 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
180 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
181 <RequiredSuffixes>
181 <RequiredSuffixes>
182 <String>Attribute</String>
182 <String>Attribute</String>
183 </RequiredSuffixes>
183 </RequiredSuffixes>
184 </NamingRule>
184 </NamingRule>
185 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
185 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
186 <RequiredSuffixes>
186 <RequiredSuffixes>
187 <String>EventArgs</String>
187 <String>EventArgs</String>
188 </RequiredSuffixes>
188 </RequiredSuffixes>
189 </NamingRule>
189 </NamingRule>
190 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
190 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
191 <RequiredSuffixes>
191 <RequiredSuffixes>
192 <String>Exception</String>
192 <String>Exception</String>
193 </RequiredSuffixes>
193 </RequiredSuffixes>
194 </NamingRule>
194 </NamingRule>
195 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
195 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
196 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
196 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
197 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
197 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
198 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
198 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
199 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
199 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
200 <RequiredPrefixes>
200 <RequiredPrefixes>
201 <String>m_</String>
201 <String>m_</String>
202 </RequiredPrefixes>
202 </RequiredPrefixes>
203 </NamingRule>
203 </NamingRule>
204 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
204 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
205 <RequiredPrefixes>
205 <RequiredPrefixes>
206 <String>_</String>
206 <String>_</String>
207 </RequiredPrefixes>
207 </RequiredPrefixes>
208 </NamingRule>
208 </NamingRule>
209 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
209 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
210 <RequiredPrefixes>
210 <RequiredPrefixes>
211 <String>m_</String>
211 <String>m_</String>
212 </RequiredPrefixes>
212 </RequiredPrefixes>
213 </NamingRule>
213 </NamingRule>
214 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
214 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
215 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
215 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
216 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
216 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
217 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
217 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
218 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
218 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
219 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
219 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
220 <RequiredPrefixes>
220 <RequiredPrefixes>
221 <String>T</String>
221 <String>T</String>
222 </RequiredPrefixes>
222 </RequiredPrefixes>
223 </NamingRule>
223 </NamingRule>
224 </Rules>
224 </Rules>
225 </NameConventionPolicy>
225 </NameConventionPolicy>
226 </Policies>
226 </Policies>
227 </Properties>
227 </Properties>
228 </MonoDevelop>
228 </MonoDevelop>
229 </ProjectExtensions>
229 </ProjectExtensions>
230 </Project> No newline at end of file
230 </Project>
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now