From b9eda344ccc9041c2306ce89afdcced4cf79698f Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 8 Jan 2012 14:03:09 -0500 Subject: [PATCH] Clean up debug reporting code. --- queuenode.ml | 12 +++++++----- squeue.ml | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/queuenode.ml b/queuenode.ml index f1c4cf7..fec8af4 100644 --- a/queuenode.ml +++ b/queuenode.ml @@ -10,13 +10,15 @@ type t = { let classname = "queue" -let rec do_burst info n = - (* - Printf.printf "INFO: do_burst %d backlog %d waiters %d ticks left\n%!" +let report info n = + Printf.printf "INFO: do_burst %d capacity, %d backlog, %d waiters, %d ticks left\n%!" + (Squeue.approx_capacity info.ch) (Fqueue.length info.backlog) (Fqueue.length info.waiters) - n; - *) + n + +let rec do_burst info n = + (* report info n; *) if Fqueue.is_empty info.backlog then false else if Fqueue.is_empty info.waiters then false diff --git a/squeue.ml b/squeue.ml index 4bd4e69..92051b1 100644 --- a/squeue.ml +++ b/squeue.ml @@ -16,6 +16,8 @@ let create n = { queue = Queue.create () } +let approx_capacity q = q.capacity + let add v q = Mutex.lock q.mtx; while q.capacity < 1 do