bild
School of
Electrical Engineering
and Computer Science

progressbar: A utility for monitoring progress

Usage

progressbar [<options>] <from> <to> <description>
Options:
-x
Exit at EOF or when progress has reached the end.
-t <string>
Use this string as window title.
-b <int>
The number of elements used to compute timing of expected time of arrival on.
-v
Output version info and exit.

Description

This is a Perl script that will open a window containing a text label and a progress bar. The labels initial string is given by <description>, and the progress bar is set to show progress in the interval [<from>,<to>].

The progress bar is updated by reading newline-delimited integers from STDIN. In addition, the text label can be updated by writing a string to input. Please note that the series of numbers does not need to be increasing.

When EOF is read from STDIN, or a number equal to or larger than <to> has been read, the progress bar is removed and ': Done' is appended to the string.

ETA is displayed once B samples have been read. This is always recalculated for the last B samples. B is 50 by default and can be adjusted using '-b'. If samples are coming rapidly, within a second, the buffer size is automatically doubled. There is an upper limit of 10 000 on the buffer size.

Availability

progressbar is distributed under the GNU General Public License. The download is simply the actual Perl script. Please note that the GTK module is required.

Please let me know if you use it! I have also set up an entry at FreshMeat for progressbar.

Related software

If you want to measure the progress of data through a pipe, you may be interested in progress or pipebench.

Example 1

Here is what progressbar looks like in a simple example. The script was started as
   cat | progressbar 0 100 Excitement
and the input was simply given on the commandline.

InputScreenshot
1
2
17
	      
Halfway
57
100

Example 2

Execute the following in bash and notice the display of estimated completion.
  (for ((i=1; i<50; i++)); do \
      echo \$i; sleep 0.05; \
   done; \
   echo Halfway;\
   for ((i=50; i<100;i++)); do\
      echo \$i;sleep 0.05;\
   done;) \
   | progressbar -x 0 100 Excitement


Published by: Lars Arvestad <arve@csc.kth.se>
Updated 2006-07-18