fdoc

modulefdoc_progress

Progress in the terminal: a live bar for each stage of the run, leaving a line with its time, and warnings that do not get mixed up with the bar. When standard output is not a terminal there are no bars or colours, just a line for each stage.

Stages run in parallel loops. Any thread can count, and only the first draws. Nothing here calls a function returning a deferred-length string (see example/slen_race.f90).

Uses

Graphs

Uses

Used by

Variables

NameTypeAttributesDefaultDescription
BAR_WIDTHintegerprivateparameter30
colourlogicalprivate.false.

true to use colours

doneintegerprivate0

how many are finished

drawnlogicalprivate.false.

true if a bar is on the screen

EMPTYcharacter(len=*)privateparameterachar(226)//achar(148)//achar(128)

─, in UTF-8

enabledlogicalprivate.false.

true to report progress

ESCcharacter(len=*)privateparameterachar(27)
FULLcharacter(len=*)privateparameterachar(226)//achar(148)//achar(129)

━, in UTF-8

labelcharacter(len=LABEL_WIDTH)private''

the current stage

LABEL_WIDTHintegerprivateparameter24
last_drawinteger(kind=int64)private0

when the bar was last drawn

livelogicalprivate.false.

true if standard output is a terminal

rateinteger(kind=int64)private1000

clock ticks in a second

REDRAW_MILLISECONDSinteger(kind=int64)privateparameter40
run_startinteger(kind=int64)private0

when the run started

stage_startinteger(kind=int64)private0

when the stage started

totalintegerprivate0

how many steps the stage has

Interfaces

c_isattybind(C)private

integer(kind=c_int) function c_isatty(fd) result(tty) bind(c, name='isatty')

C isatty.

Subroutines

bar_textpure

pure subroutine bar_text(steps, size, width, filled, unfilled, percent)

The bar for steps of size steps, width characters wide, with its filled and empty parts.

drawprivate

subroutine draw()

Draw the bar of the current stage.

progress_enable

subroutine progress_enable()

Turn progress reports on.

progress_finish

subroutine progress_finish()

Finish the stage, leaving its line.

progress_start

subroutine progress_start(name, steps)

Start stage name, of steps steps, or of unknown length if that is 0.

progress_summary

subroutine progress_summary(message)

Report the end of the run.

progress_tick

subroutine progress_tick(steps)

Count a step, or steps of them. This can be called from any thread.

seconds_textprivate

subroutine seconds_text(ticks, text)

ticks of the clock as text.

warn

subroutine warn(message)

Write warning message to standard error, keeping the bar intact. This can be called from any thread.