Skip to content

Add Uring.active_ops #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/uring/uring.ml
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,12 @@ module Stats = struct
sketch_used sketch_buffer_size sketch_old_buffers
end

let active_ops t = Heap.in_use t.data

let get_debug_stats t =
{ Stats.
sqe_ready = Uring.sq_ready t.uring;
active_ops = Heap.in_use t.data;
active_ops = active_ops t;
sketch_used = t.sketch.off;
sketch_buffer_size = Bigarray.Array1.dim t.sketch.buffer;
sketch_old_buffers = List.length t.sketch.old_buffers;
Expand Down
14 changes: 9 additions & 5 deletions lib/uring/uring.mli
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,17 @@ val peek : 'a t -> 'a completion_option
val error_of_errno : int -> Unix.error
(** [error_of_errno e] converts the error code [abs e] to a Unix error type. *)

val active_ops : _ t -> int
(** [active_ops t] returns the number of operations added to the ring (whether submitted or not)
for which the completion event has not yet been collected. *)

module Stats : sig
type t = {
sqe_ready : int;
active_ops : int;
sketch_buffer_size : int;
sketch_used : int;
sketch_old_buffers : int;
sqe_ready : int; (** SQEs not yet submitted. *)
active_ops : int; (** See {!active_ops}. *)
sketch_buffer_size : int; (** Size of the current sketch buffer. *)
sketch_used : int; (** Bytes used within current sketch buffer. *)
sketch_old_buffers : int; (** Old sketch buffers waiting to be freed. *)
}

val pp : t Fmt.t
Expand Down