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.

With --progress-lines there are lines for another program to read from standard output instead, each written at once. Warnings stay on standard error, and a run that fails has no [end] line.

[ 42%] Parsing files 83/198
[done] Parsing files in 0.22 s
[end] 3456 pages written to ./doc in 2.31 s

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

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

last_percentintegerprivate-1

the last percentage written, with lines

lineslogicalprivate.false.

true to write lines for another program

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(for_programs)

Turn progress reports on, with lines for another program if for_programs.

progress_finish

subroutine progress_finish()

Finish the stage, leaving its line.

progress_linepure

pure subroutine progress_line(percent, name, count, size, line)

The line for another program of count of size steps done in stage name.

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.

write_lineprivate

subroutine write_line(count)

Write the line of count steps done, if its percentage is new. This can be called from any thread.