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