annotate MonoPlay/Program.cs @ 220:42814145d472 v2

.csproj changes
author cin
date Tue, 20 Jun 2017 19:45:52 +0300
parents d7cd7a83189a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
1 using Implab;
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
2 using Implab.Parallels;
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
3 using Implab.Diagnostics;
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
4 using System.Threading;
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
5
dc4942d09e74 improved tracing
cin
parents:
diff changeset
6 namespace MonoPlay {
dc4942d09e74 improved tracing
cin
parents:
diff changeset
7 class MainClass {
145
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
8
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
9
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
10 public static void Main(string[] args) {
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
11 var pool = new WorkerPool(10);
150
3258399cba83 JSONWriter improvements
cin
parents: 145
diff changeset
12
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
13 var listerner = new ConsoleTraceListener();
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
14 listerner.Subscribe<TraceEvent>();
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
15
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
16 TraceLog.StartLogicalOperation("Main");
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
17
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
18
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
19 var d = pool.Invoke(() => {
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
20 TraceLog.StartLogicalOperation("Worker");
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
21 Thread.Sleep(100);
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
22 TraceLog.TraceInformation("worker done");
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
23 TraceLog.EndLogicalOperation();
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
24 });
136
e9e7940c7d98 shared locks + tests
cin
parents: 125
diff changeset
25
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
26 var op = TraceContext.Instance.CurrentOperation;
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
27 ThreadPool.QueueUserWorkItem((o) => {
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
28 TraceContext.Instance.EnterLogicalOperation(op, false);
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
29 TraceLog.StartLogicalOperation("Thread");
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
30 Thread.Sleep(100);
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
31 TraceLog.TraceInformation("thread done");
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
32 TraceLog.EndLogicalOperation();
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
33 });
150
3258399cba83 JSONWriter improvements
cin
parents: 145
diff changeset
34
201
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
35 TraceLog.TraceInformation("main done");
d7cd7a83189a TraceLog tests
cin
parents: 194
diff changeset
36 TraceLog.EndLogicalOperation();
194
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
37
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
38 d.Join();
d45bdf510514 working on diagnostics
cin
parents: 183
diff changeset
39
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
40
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
41
145
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
42 }
136
e9e7940c7d98 shared locks + tests
cin
parents: 125
diff changeset
43
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
44 }
dc4942d09e74 improved tracing
cin
parents:
diff changeset
45 }