module Byte_units: sig
.. end
create measure value
creates a t
from value
units of the given measure.
module Measure: sig
.. end
type
t
val create : Measure.t -> float -> t
create measure value
creates a t
from value
units of the given measure.
include Comparable.S
include Hashable.S
include Stringable.S
val to_string_hum : ?measure:Measure.t -> t -> string
to_string_hum ?measure t
returns a string representation of t
. If measure
is
not given then the largest measure (excluding `Words
) is used that causes the
translated value to exceed 1.
val bytes : t -> float
val kilobytes : t -> float
val megabytes : t -> float
val gigabytes : t -> float
val words : t -> float
val scale : t -> float -> t
scale t mul
scale the measure t
by mul
module Infix: sig
.. end
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read_ml.reader
val bin_read_t_ : t Bin_prot.Unsafe_read_c.reader
val bin_read_t__ : (int -> t) Bin_prot.Unsafe_read_c.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write_ml.writer
val bin_write_t_ : t Bin_prot.Unsafe_write_c.writer
val bin_writer_t : t Bin_prot.Type_class.writer
create measure value
creates a t
from value
units of the given measure.
to_string_hum ?measure t
returns a string representation of t
. If measure
is
not given then the largest measure (excluding `Words
) is used that causes the
translated value to exceed 1.
scale t mul
scale the measure t
by mul
( / ) t mul
scales t
by 1/mul
( // ) t1 t2
returns the ratio of t1 to t2