Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 236037e

Browse files
committed
use trace not debug
1 parent 9087936 commit 236037e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/fsharp/vs/Reactor.fs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module internal Reactor =
4444

4545
// Async workflow which receives messages and dispatches to worker functions.
4646
let rec loop (bgOpOpt, onComplete, bg) =
47-
async { Debug.WriteLine("Reactor: receiving..., remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
47+
async { Trace.TraceInformation("Reactor: receiving..., remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
4848

4949
// Messages always have priority over the background op.
5050
let! msg =
@@ -61,37 +61,37 @@ module internal Reactor =
6161

6262
match msg with
6363
| Some (SetBackgroundOp bgOpOpt) ->
64-
Debug.WriteLine("Reactor: --> set background op, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
64+
Trace.TraceInformation("Reactor: --> set background op, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
6565
return! loop (bgOpOpt, onComplete, false)
6666
| Some (Op (desc, ct, op, ccont)) ->
6767
if ct.IsCancellationRequested then ccont() else
68-
Debug.WriteLine("Reactor: --> {0}, remaining {1}, mem {2}, gc2 {3}", desc, inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
68+
Trace.TraceInformation("Reactor: --> {0}, remaining {1}, mem {2}, gc2 {3}", desc, inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
6969
let time = System.DateTime.Now
7070
op()
7171
let span = System.DateTime.Now - time
7272
//if span.TotalMilliseconds > 100.0 then
73-
Debug.WriteLine("Reactor: <-- {0}, remaining {1}, took {2}ms", desc, inbox.CurrentQueueLength, span.TotalMilliseconds)
73+
Trace.TraceInformation("Reactor: <-- {0}, remaining {1}, took {2}ms", desc, inbox.CurrentQueueLength, span.TotalMilliseconds)
7474
return! loop (bgOpOpt, onComplete, false)
7575
| Some (WaitForBackgroundOpCompletion channel) ->
76-
Debug.WriteLine("Reactor: --> wait for background (debug only), remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
76+
Trace.TraceInformation("Reactor: --> wait for background (debug only), remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
7777
match bgOpOpt with
7878
| None -> ()
7979
| Some bgOp -> while bgOp() do ()
8080
channel.Reply(())
8181
return! loop (None, onComplete, false)
8282
| Some (CompleteAllQueuedOps channel) ->
83-
Debug.WriteLine("Reactor: --> stop background work and complete all queued ops, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
83+
Trace.TraceInformation("Reactor: --> stop background work and complete all queued ops, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
8484
return! loop (None, Some channel, false)
8585
| None ->
8686
match bgOpOpt, onComplete with
8787
| _, Some onComplete -> onComplete.Reply()
8888
| Some bgOp, None ->
89-
Debug.WriteLine("Reactor: --> background step, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
89+
Trace.TraceInformation("Reactor: --> background step, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
9090
let time = System.DateTime.Now
9191
let res = bgOp()
9292
let span = System.DateTime.Now - time
9393
//if span.TotalMilliseconds > 100.0 then
94-
Debug.WriteLine("Reactor: <-- background step, remaining {0}, took {1}ms", inbox.CurrentQueueLength, span.TotalMilliseconds)
94+
Trace.TraceInformation("Reactor: <-- background step, remaining {0}, took {1}ms", inbox.CurrentQueueLength, span.TotalMilliseconds)
9595
return! loop ((if res then Some bgOp else None), onComplete, true)
9696
| None, None -> failwith "unreachable, should have used inbox.Receive"
9797
}
@@ -106,28 +106,28 @@ module internal Reactor =
106106

107107
// [Foreground Mailbox Accessors] -----------------------------------------------------------
108108
member r.SetBackgroundOp(build) =
109-
Debug.WriteLine("Reactor: enqueue start background, length {0}", builder.CurrentQueueLength)
109+
Trace.TraceInformation("Reactor: enqueue start background, length {0}", builder.CurrentQueueLength)
110110
builder.Post(SetBackgroundOp build)
111111

112112
member r.EnqueueOp(desc, op) =
113-
Debug.WriteLine("Reactor: enqueue {0}, length {1}", desc, builder.CurrentQueueLength)
113+
Trace.TraceInformation("Reactor: enqueue {0}, length {1}", desc, builder.CurrentQueueLength)
114114
builder.Post(Op(desc, CancellationToken.None, op, (fun () -> ())))
115115

116116
member r.EnqueueOpPrim(desc, ct, op, ccont) =
117-
Debug.WriteLine("Reactor: enqueue {0}, length {1}", desc, builder.CurrentQueueLength)
117+
Trace.TraceInformation("Reactor: enqueue {0}, length {1}", desc, builder.CurrentQueueLength)
118118
builder.Post(Op(desc, ct, op, ccont))
119119

120120
member r.CurrentQueueLength =
121121
builder.CurrentQueueLength
122122

123123
// This is for testing only
124124
member r.WaitForBackgroundOpCompletion() =
125-
Debug.WriteLine("Reactor: enqueue wait for background, length {0}", builder.CurrentQueueLength)
125+
Trace.TraceInformation("Reactor: enqueue wait for background, length {0}", builder.CurrentQueueLength)
126126
builder.PostAndReply WaitForBackgroundOpCompletion
127127

128128
// This is for testing only
129129
member r.CompleteAllQueuedOps() =
130-
Debug.WriteLine("Reactor: enqueue wait for background, length {0}", builder.CurrentQueueLength)
130+
Trace.TraceInformation("Reactor: enqueue wait for background, length {0}", builder.CurrentQueueLength)
131131
builder.PostAndReply WaitForBackgroundOpCompletion
132132

133133
member r.EnqueueAndAwaitOpAsync (desc, f) =

0 commit comments

Comments
 (0)