Auto status change to "Under Review"
| @@ -132,7 +132,7 namespace Implab.Test { | |||||
| 132 | ShouldThrow(() => p.Join(1000)); |
|
132 | ShouldThrow(() => p.Join(1000)); | |
| 133 | Assert.AreEqual(ExecutionState.Failed, comp.State); |
|
133 | Assert.AreEqual(ExecutionState.Failed, comp.State); | |
| 134 |
|
134 | |||
| 135 |
Assert.Is |
|
135 | Assert.IsTrue(comp.LastError is OperationCanceledException); | |
| 136 |
|
136 | |||
| 137 | comp.Dispose(); |
|
137 | comp.Dispose(); | |
| 138 | } |
|
138 | } | |
| @@ -185,7 +185,7 namespace Implab.Test { | |||||
| 185 | p.Cancel(); |
|
185 | p.Cancel(); | |
| 186 | ShouldThrow(() => p.Join(1000)); |
|
186 | ShouldThrow(() => p.Join(1000)); | |
| 187 | Assert.AreEqual(ExecutionState.Failed, comp.State); |
|
187 | Assert.AreEqual(ExecutionState.Failed, comp.State); | |
| 188 |
Assert.Is |
|
188 | Assert.IsTrue(comp.LastError is OperationCanceledException); | |
| 189 |
|
189 | |||
| 190 | comp.Dispose(); |
|
190 | comp.Dispose(); | |
| 191 | } |
|
191 | } | |
| @@ -59,8 +59,8 namespace Implab.Diagnostics { | |||||
| 59 |
|
59 | |||
| 60 | public void UnsubscribeAll() { |
|
60 | public void UnsubscribeAll() { | |
| 61 | lock (m_subscriptions) { |
|
61 | lock (m_subscriptions) { | |
| 62 |
foreach (var |
|
62 | foreach (var remove in m_subscriptions.Values) | |
| 63 |
|
|
63 | remove(); | |
| 64 | m_subscriptions.Clear(); |
|
64 | m_subscriptions.Clear(); | |
| 65 | } |
|
65 | } | |
| 66 | } |
|
66 | } | |
| @@ -69,7 +69,7 namespace Implab.Diagnostics { | |||||
| 69 | this, |
|
69 | this, | |
| 70 | new LogEventArgs<TEvent>( |
|
70 | new LogEventArgs<TEvent>( | |
| 71 | data, |
|
71 | data, | |
| 72 |
|
|
72 | this, | |
| 73 | traceContext.ThreadId, |
|
73 | traceContext.ThreadId, | |
| 74 | traceContext.CurrentOperation, |
|
74 | traceContext.CurrentOperation, | |
| 75 | traceContext.CurrentOperation.Duration |
|
75 | traceContext.CurrentOperation.Duration | |
| @@ -77,5 +77,9 namespace Implab.Diagnostics { | |||||
| 77 | ); |
|
77 | ); | |
| 78 | } |
|
78 | } | |
| 79 | } |
|
79 | } | |
|
|
80 | ||||
|
|
81 | public override string ToString() { | |||
|
|
82 | return Name; | |||
|
|
83 | } | |||
| 80 | } |
|
84 | } | |
| 81 | } |
|
85 | } | |
| @@ -2,7 +2,7 | |||||
| 2 |
|
2 | |||
| 3 | namespace Implab.Diagnostics { |
|
3 | namespace Implab.Diagnostics { | |
| 4 | public class LogEventArgs : EventArgs { |
|
4 | public class LogEventArgs : EventArgs { | |
| 5 |
public |
|
5 | public object Channel { | |
| 6 | get; |
|
6 | get; | |
| 7 | private set; |
|
7 | private set; | |
| 8 | } |
|
8 | } | |
| @@ -18,8 +18,8 namespace Implab.Diagnostics { | |||||
| 18 | get; |
|
18 | get; | |
| 19 | private set; |
|
19 | private set; | |
| 20 | } |
|
20 | } | |
| 21 |
public LogEventArgs( |
|
21 | public LogEventArgs(object channel, int threadId, LogicalOperation operation, int timeOffset) { | |
| 22 |
Channel |
|
22 | Channel = channel; | |
| 23 | ThreadId = threadId; |
|
23 | ThreadId = threadId; | |
| 24 | Operation = operation; |
|
24 | Operation = operation; | |
| 25 | OperationTimeOffset = timeOffset; |
|
25 | OperationTimeOffset = timeOffset; | |
| @@ -5,7 +5,7 | |||||
| 5 | private set; |
|
5 | private set; | |
| 6 | } |
|
6 | } | |
| 7 |
|
7 | |||
| 8 |
public LogEventArgs(TEvent value, |
|
8 | public LogEventArgs(TEvent value,object channel, int threadId, LogicalOperation operation, int timeOffset) : base(channel, threadId, operation, timeOffset) { | |
| 9 | Value = value; |
|
9 | Value = value; | |
| 10 | } |
|
10 | } | |
| 11 | } |
|
11 | } | |
| @@ -18,7 +18,7 namespace Implab.Diagnostics { | |||||
| 18 | var msg = new StringBuilder(); |
|
18 | var msg = new StringBuilder(); | |
| 19 | for (int i = 0; i < args.Operation.Level; 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, args.Channel |
|
21 | msg.AppendFormat("[{0}]:{1}: {2}", args.ThreadId, args.Channel, entry); | |
| 22 |
|
22 | |||
| 23 | lock (m_textWriter) { |
|
23 | lock (m_textWriter) { | |
| 24 | if (!IsDisposed) { |
|
24 | if (!IsDisposed) { | |
| @@ -77,7 +77,6 | |||||
| 77 | <ItemGroup> |
|
77 | <ItemGroup> | |
| 78 | <Compile Include="CustomEqualityComparer.cs" /> |
|
78 | <Compile Include="CustomEqualityComparer.cs" /> | |
| 79 | <Compile Include="Diagnostics\ConsoleTraceListener.cs" /> |
|
79 | <Compile Include="Diagnostics\ConsoleTraceListener.cs" /> | |
| 80 | <Compile Include="Diagnostics\EventText.cs" /> |
|
|||
| 81 | <Compile Include="Diagnostics\LogChannel.cs" /> |
|
80 | <Compile Include="Diagnostics\LogChannel.cs" /> | |
| 82 | <Compile Include="Diagnostics\LogicalOperation.cs" /> |
|
81 | <Compile Include="Diagnostics\LogicalOperation.cs" /> | |
| 83 | <Compile Include="Diagnostics\TextFileListener.cs" /> |
|
82 | <Compile Include="Diagnostics\TextFileListener.cs" /> | |
| @@ -4,39 +4,42 using System.Threading.Tasks; | |||||
| 4 | using Implab.Formats.JSON; |
|
4 | using Implab.Formats.JSON; | |
| 5 | using System.IO; |
|
5 | using System.IO; | |
| 6 | using System.Text.Json; |
|
6 | using System.Text.Json; | |
|
|
7 | using System.Diagnostics; | |||
|
|
8 | using Implab.Parallels; | |||
|
|
9 | using System.Threading; | |||
| 7 |
|
10 | |||
| 8 | namespace MonoPlay { |
|
11 | namespace MonoPlay { | |
| 9 | class MainClass { |
|
12 | class MainClass { | |
| 10 |
|
13 | |||
| 11 |
|
14 | |||
| 12 | public static void Main(string[] args) { |
|
15 | public static void Main(string[] args) { | |
| 13 | if (args == null) |
|
16 | var pool = new WorkerPool(10); | |
| 14 | throw new ArgumentNullException("args"); |
|
|||
| 15 | int t1, t2; |
|
|||
| 16 |
|
17 | |||
| 17 | for (int i = 0; i < 2; i++) { |
|
18 | var listerner = new ConsoleTraceListener(); | |
| 18 | t1 = Environment.TickCount; |
|
19 | listerner.TraceOutputOptions = TraceOptions.LogicalOperationStack; | |
| 19 | int elements =0; |
|
20 | Trace.Listeners.Add(listerner); | |
| 20 | using (var reader = new JSONParser(File.OpenText("/home/sergey/temp/citylots.json"))) { |
|
21 | ||
| 21 | while (reader.Read()) |
|
22 | Trace.CorrelationManager.StartLogicalOperation("Main"); | |
| 22 | elements++; |
|
|||
| 23 | } |
|
|||
| 24 |
|
23 | |||
| 25 | t2 = Environment.TickCount; |
|
24 | var d = pool.Invoke(() => { | |
| 26 | Console.WriteLine("attempt {0} done: {1} ms, {2:.00} Mb, {3} GC, Elements: {4}",i+1, t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0), elements ); |
|
25 | Trace.CorrelationManager.StartLogicalOperation("Worker"); | |
| 27 | } |
|
26 | Thread.Sleep(100); | |
|
|
27 | Trace.TraceInformation("worker done"); | |||
|
|
28 | Trace.CorrelationManager.StopLogicalOperation(); | |||
|
|
29 | }); | |||
| 28 |
|
30 | |||
| 29 | Console.WriteLine("Syste.Text.Json"); |
|
31 | ThreadPool.QueueUserWorkItem((o) => { | |
| 30 | var paraser = new JsonParser(); |
|
32 | Trace.CorrelationManager.StartLogicalOperation("Thread"); | |
| 31 | for (int i = 0; i < 2; i++) { |
|
33 | Thread.Sleep(100); | |
| 32 | t1 = Environment.TickCount; |
|
34 | Trace.TraceInformation("thread done"); | |
| 33 | using (var reader = File.OpenText("/home/sergey/temp/citylots.json")) { |
|
35 | Trace.CorrelationManager.StopLogicalOperation(); | |
| 34 | paraser.Parse(reader); |
|
36 | }); | |
| 35 | } |
|
|||
| 36 |
|
37 | |||
| 37 | t2 = Environment.TickCount; |
|
38 | Trace.TraceInformation("main done"); | |
| 38 | Console.WriteLine("attempt {0} done: {1} ms, {2:.00} Mb, {3} GC, ",i+1, t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0)); |
|
39 | Trace.CorrelationManager.StopLogicalOperation(); | |
| 39 | } |
|
40 | ||
|
|
41 | d.Join(); | |||
|
|
42 | ||||
| 40 |
|
43 | |||
| 41 |
|
44 | |||
| 42 | } |
|
45 | } | |
| 1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 3
ok, latest stable version should be in default
You need to be logged in to leave comments.
Login now
