package progress
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=1f101c2823d84d4dc8af693d1571ebdd614f30d675f8efeedf0d6c3018f602e2
sha512=663494ac7f4ddcbc130edc90f5ae036ec198b44f826a966fa94edee419ce7d9bb7e00a5c3996eb65b2d8213a3907a05fff60707f828102ef1e5c5133bcd78037
doc/progress/Progress/index.html
Module Progress
Source
A library for displaying progress bars, including support for rendering multiple bars at once. Start by describing of a set of progress bars, then begin rendering them to get access to their respective reporting functions.
See Progress_unix
for access to Unix-specific utilities.
Description
The type of progress bars with reporting functions of type 'a
. You'll get access to the reporting functions when beginning the rendering process.
val counter :
total:int64 ->
?mode:[ `ASCII | `UTF8 ] ->
?message:string ->
?pp:(int64, int64 Segment.t) Units.pp_fixed ->
?width:int ->
?sampling_interval:int ->
unit ->
(int64 -> unit) t
counter ~total ()
is a progress bar of the form:
<message?> <count?> [########..............................] XX%
where each reported value contributes cumulatively towards an eventual total of total
. Optional parameters are as follows:
?mode
specifies whether to use a UTF-8 or an ASCII encoding for the progress bar. The UTF-8 encoding shows a higher resolution of progress, but may not be supported in all terminals. The default is`UTF8
.
?pp
is used to pretty-print the<count>
segment, if passed. For example,Units.bytes
can be used for totals measured in bytes. The default is to not display this segment.
?width
is the width of the bar in columns. Defaults to the width ofstdout
, if it is a terminal.
?sampling_interval
specifies the number of reported values that must be passed for each update of the display (not including the update during finalisation, which always occurs). This is useful when progress is being reported from a hot-loop, where the cost of re-displaying the progress bar is non-negligible. The default value is1
, meaning that all updates are displayed immediately.
See Progress_unix.counter
for an equivalent that contains a timer.
Define a new progress bar from a specification, with the given initial value.
Multiple progress bars
Stack progress bars vertically. a / b
is a set with a
stacked on top of b
. The two bars have separate reporting functions (supplied as a pair).
Rendering
Render a set of progress bars inside a continuation.
Functions for explicitly starting and stopping the process of rendering a bar; useful when the code doing the progress reporting cannot be conveniently delimited inside with_display
. All display
s must be properly finalise
d, and it is not possible to interleave rendering of displays.