Skip to content

Commit

Permalink
v0.14.1
Browse files Browse the repository at this point in the history
Signed-off-by: Cameron Wong <cwong@janestreet.com>
  • Loading branch information
cwong-ocaml committed Nov 17, 2020
1 parent d78b221 commit 7e50751
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/command.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,9 @@ module Base = struct
| Arg.Tuple _ ->
failwith "Arg.Tuple is not supported by Command.Spec.flags_of_args_exn"
| ((Arg.Expand _)[@if ocaml_version >= (4, 05, 0)]) ->
failwith "Arg.Expand is not supported by Command.Spec.flags_of_args_exn")
failwith "Arg.Expand is not supported by Command.Spec.flags_of_args_exn"
| ((Arg.Rest_all _)[@if ocaml_version >= (4, 12, 0)]) ->
failwith "Arg.Rest_all is not supported by Command.Spec.flags_of_args_exn")
;;

module Deprecated = struct
Expand Down Expand Up @@ -1443,7 +1445,7 @@ module Base = struct
Map.fold ts ~init:(return []) ~f:(fun ~key:name ~data:t init ->
map2 init t ~f:(fun init value ->
Option.fold value ~init ~f:(fun init value -> (name, value) :: init)))
|> map ~f:(function
|> map ~f:(fun value : b -> match value with
| _ :: _ :: _ as passed ->
die
!"Cannot pass more than one of these: \n\
Expand Down
29 changes: 28 additions & 1 deletion src/gc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ include Caml.Gc

module Stat = struct
module T = struct
[%%if ocaml_version >= (4, 12, 0)]

type t = Caml.Gc.stat =
{ minor_words : float
; promoted_words : float
Expand All @@ -33,9 +35,34 @@ module Stat = struct
; compactions : int
; top_heap_words : int
; stack_size : int
; forced_major_collections : int
}
[@@deriving compare, hash, bin_io, sexp, fields]
end

[%%else]

type t = Caml.Gc.stat =
{ minor_words : float
; promoted_words : float
; major_words : float
; minor_collections : int
; major_collections : int
; heap_words : int
; heap_chunks : int
; live_words : int
; live_blocks : int
; free_words : int
; free_blocks : int
; largest_free : int
; fragments : int
; compactions : int
; top_heap_words : int
; stack_size : int
}
[@@deriving compare, hash, bin_io, sexp, fields]

[%%endif]
end

include T
include Comparable.Make (T)
Expand Down
47 changes: 47 additions & 0 deletions src/gc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ open! Import
(* $Id: gc.mli,v 1.42 2005-10-25 18:34:07 doligez Exp $ *)
*)
module Stat : sig
[%%if ocaml_version >= (4, 12, 0)]

type t =
{ minor_words : float
(** Number of words allocated in the minor heap since
Expand Down Expand Up @@ -55,9 +57,54 @@ module Stat : sig
; compactions : int (** Number of heap compactions since the program was started. *)
; top_heap_words : int (** Maximum size reached by the major heap, in words. *)
; stack_size : int (** Current size of the stack, in words. *)
; forced_major_collections : int
(** Number of forced full major collections completed since the program
was started. @since v0.14.1 *)
}
[@@deriving bin_io, sexp, fields]

[%%else]

type t =
{ minor_words : float
(** Number of words allocated in the minor heap since
the program was started. This number is accurate in
byte-code programs, but only an approximation in programs
compiled to native code. *)
; promoted_words : float
(** Number of words allocated in the minor heap that
survived a minor collection and were moved to the major heap
since the program was started. *)
; major_words : float
(** Number of words allocated in the major heap, including
the promoted words, since the program was started. *)
; minor_collections : int
(** Number of minor collections since the program was started. *)
; major_collections : int
(** Number of major collection cycles completed since the program
was started. *)
; heap_words : int (** Total size of the major heap, in words. *)
; heap_chunks : int
(** Number of contiguous pieces of memory that make up the major heap. *)
; live_words : int
(** Number of words of live data in the major heap, including the header
words. *)
; live_blocks : int (** Number of live blocks in the major heap. *)
; free_words : int (** Number of words in the free list. *)
; free_blocks : int (** Number of blocks in the free list. *)
; largest_free : int (** Size (in words) of the largest block in the free list. *)
; fragments : int
(** Number of wasted words due to fragmentation. These are
1-words free blocks placed between two live blocks. They
are not available for allocation. *)
; compactions : int (** Number of heap compactions since the program was started. *)
; top_heap_words : int (** Maximum size reached by the major heap, in words. *)
; stack_size : int (** Current size of the stack, in words. *)
}
[@@deriving bin_io, sexp, fields]

[%%endif]

include Comparable.S with type t := t
end

Expand Down

0 comments on commit 7e50751

Please sign in to comment.