Notes:
BAR(1)
NAME
bar - show information about a data transfer
SYNOPSIS
bar [ I/O-options ] [ display-options ] [ color-options ]
[ -h | --help ] [ -v | --version ]
DESCRIPTION
Bar is a simple tool to process a stream of data and print a display
for the user on stderr showing (a) the amount of data passed, (b) the
throughput of the data transfer, and, if the total size of the data
stream is known, (c) estimated time remaining, percent complete, and a
progress bar.
Bar was originally written for the purpose of estimating the amount of
time needed to transfer large amounts (many, many gigabytes) of data
across a network. (Usually in an SSH/tar pipe.)
I/O COMMAND LINE OPTIONS
-if input-file
--in-file input-file
Read input from input-file. Default: stdin
-of output-file
--out-file output-file
Write output to output-file. Default: stdout
-s size
--size size
Expect an input stream of size bytes.
When reading a regular file or a link to a regular file, bar will
extract the file size on it's own. However, this flag is useful for
reading from a character- or block-special device file, or from a
pipe. size may be followed by 'k', 'm', 'g', 't', 'p', or 'e' for
kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes,
respectively (see also the -k option below). Alternatively, size may
also be specified in terms of 'b' for blocks (see the -bl option
below). See examples below.
-bs buffer-size
--buffer-size buffer-size
Allocate an I/O buffer of buffer-size bytes. The same modifiers may
apply here ('k', 'm', 'g', 't', 'p', 'e' and 'b') as for the -s flag
above. Changing the buffer size can improve throughput, depending on
your application of bar. For fast I/O operations, say from a ramdisk
for instance, it might be worth your while to experiment with a large
buffer (circa 1MB for instance). But for slow I/O operations, like
from a tape drive, you could merely be wasting your memory. Default:
52488 (512KB)
-th rate
--throttle rate
Restrict I/O throughput to rate bytes per second. The same modifiers
apply here ('k', 'm', 'g', 't', 'p', 'e' and 'b') as for the -s flag
above.
-i seconds
--interval seconds
Update the display every seconds seconds. Default: 1 second
-t microseconds
--timeout microseconds
The number of microseconds to wait for a change in I/O state before
select() times out. Default: 250000 (1/4 second)
-k 1000|1024
--kilo 1000|1024
Use either 1000 or 1024 as the definition of a kilobyte. Default:
1024
-bl size
--block-size size
When reading sizes from the command line that are specified in terms
of blocks, assume a single block is size bytes. Size may be followed
by 'k', 'm', 'g', 't', 'p', or 'e' for kilobytes, megabytes, giga-
bytes, terabytes, petabytes, or exabytes, respectively. Block size
must be set before specifying any sizes in terms of blocks or the
default value will be used instead. Specifying size in terms of 'b'
for blocks is not allowed for this option. Default: 512
DISPLAY COMMAND LINE OPTIONS
-sw width
--screen-width width
Assume a screen width of width characters.
Bar will attempt to retrieve the width of the terminal it is running
on, and will adjust that width if the terminal is resized. If bar
cannot determine the terminal width, then bar will assume a default
width of 79 characters. Use the --screen-width command line option
to override this behavior and specify a fixed width for bar to use.
(When this option is used, bar will ignore terminal resized signals
and continue to use the value provided by the user.)
-sw-1 | --screen-width-minus-one
-sw-0 | --screen-width-minus-zero
Instruct bar to use either the entire column width reported by
termio, or one less than reported by termio. I.e. If termio reports
that you are running bar in a terminal that's 80 characters wide,
using the command line option --screen-width-minus-one instructs bar
to only use 79 characters to print the display. If you're using a
terminal or shell that wraps the line whenever bar prints the last
character then this should alleviate that problem. Default is to use
the full terminal's width.
-ti string | --title string
Set the title to string.
-dti | -nti
--display-title | --no-title
Turn on/off the title display. Even if on, if no title string is set
then no title will be displayed. Default is on.
-dtw | --display-twiddle
-ntw | --no-twiddle
Turn on/off the twiddle in the display.
-dc | --display-count
-nc | --no-count
Turn on/off the data count in the display. Default is on.
-dcb | -ncb
--display-count-bits | --no-count-bits
Display the data count at bits instead of as bytes. Default is off.
By default bar will display the data count as bytes using the nota-
tion of "B". Using this option, bar will display the throughput as
bits using the notation of "b".
-dth | --display-throughput
-nth | --no-throughput
Turn on/off the data throughput in the display. Default is on.
-dthb | -nthb
--display-throughput-bits | --no-throughput-bits
Display throughput as bits/second instead of as bytes/second.
Default is off.
By default bar will display the throughput as bytes/second using the
notation of "B/s". Using this option, bar will display the through-
put as bits/second using the notation of "b/s".
-dt | --display-time
-nt | --no-time
Turn on/off the time elapsed or eta in the display. Default is on.
-de | --display-elapsed-only
-ne | --no-elapsed-only
Force bar to display the elapsed time instead of the eta. Default is
off.
-dp | --display-percent
-np | --no-percent
Turn on/off percent complete in the display. Default is on.
-db | --display-bar
-nb | --no-bar
Turn on/off the progress bar in the display. Default is on.
-ds | --display-summary
-ns | --no-summary
Turn on/off the summary information displayed when the operation is
complete. Default is on.
-da | --display-all
-dn | --display-none
Turn on/off all displays. -dn is equivalent to -ntw -nc -nth -nt -np
-nb. (Using -dn followed by -db would be equivalent to -ntw -nc -nth
-nt -np.) -da is equivalent to -dtw -dc -dth -dt -dp -db.
COLOR COMMAND LINE OPTIONS
For the following color-specific command line options, the following
keywords are recognized as valid color names: normal, black, red,
green, yellow, blue, magenta, cyan, and white
-dan | --display-ansi
-nan | --no-ansi
Turn on/off the use of ansi color codes in the display.
-spbg color | --space-background color
Use color as the background color for spacing between display
objects. Default: normal
-twfg color | --twiddle-foreground color
-twbg color | --twiddle-background color
Use color as the twiddle color in the display. Default: normal
-twb | --twiddle-bold
-twn | --twiddle-normal
Turn on/off the use of bold font when displaying the twiddle.
Default off
-tifg color | --title-foreground color
-tibg color | --title-background color
Use color as the title color in the display. Default: normal
-tib | --title-bold
-tin | --title-normal
Turn on/off the use of bold font when displaying the title. Default
off
-cfg color | --count-foreground color
-cbg color | --count-background color
Use color as the data count color in the display. Default: normal
-cb | --count-bold
-cn | --count-normal
Turn on/off the use of bold font when displaying the data count.
Default off
-thlfg color | --throughput-label-foreground color
-thlbg color | --throughput-label-background color
Use color as the throughput label color in the display. Default:
normal
-thlb | --throughput-label-bold
-thln | --throughput-label-normal
Turn on/off the use of bold font when displaying the throughput
label. Default off
-thfg color | --throughput-foreground color
-thbg color | --throughput-background color
Use color as the throughput color in the display. Default: normal
-thb | --throughput-bold
-thn | --throughput-normal
Turn on/off the use of bold font when displaying the throughput.
Default off
-tlfg color | --time-label-foreground color
-tlbg color | --time-label-background color
Use color as the time label color in the display. Default: normal
-tlb | --time-label-bold
-tln | --time-label-normal
Turn on/off the use of bold font when displaying the time label.
Default off
-tfg color | --time-foreground color
-tbg color | --time-background color
Use color as the time color in the display. Default: normal
-tb | --time-bold
-tn | --time-normal
Turn on/off the use of bold font when displaying the time. Default
off
-pfg color | --percent-foreground color
-pbg color | --percent-background color
Use color as the percent color in the display. Default: normal
-pb | --percent-bold
-pn | --percent-normal
Turn on/off the use of bold font when displaying the percent.
Default off
-bbfg color | --bar-brace-foreground color
-bbbg color | --bar-brace-background color
Use color as the brace color around the progress bar in the display.
Default: normal
-bbb | --bar-brace-bold
-bbn | --bar-brace-normal
Turn on/off the use of bold font when displaying the bar braces.
Default off
-bfg color | --bar-foreground color
-bbg color | --bar-background color
Use color as the color of the progress bar in the display. Default:
normal
-bb | --bar-bold
-bn | --bar-normal
Turn on/off the use of bold font when displaying the progress bar.
Default off
-h | --help
Display this text and exit.
-v | --version
Display the program version and exit.
RESOURCE FILE OPTIONS
Some command line options may be specified in a resource file. Bar
will search for a resource file by the name of ~/.barrc and, if found,
bar will use the values within by default. In addition, bar will also
search for a file in the directory in which it is run, ./.barrc. If
this file exists, it's values will override the values found in
~/.barrc. Values in both files may be overridden by command line
flags. Lines that begin with a # are ignored.
For resource options requiring a boolean value, the following values
are recognized: on and off, yes and no, (and the single-character
abbreviations y and n), true and false, (and the single-character
abbreviations t and f), 0 and 1.
For resource options requiring a color value, the same keywords are
recognized as for the color-specific command line options above: nor-
mal, black, red, green, yellow, blue, magenta, cyan, and white
buffer-size: buffer-size
Allocate an I/O buffer of buffer-size bytes. See the --buffer-size
command line option above.
throttle: rate
Restrict I/O throughput to rate bytes per second. See the --throttle
command line option above.
interval: seconds
Update the display every seconds seconds. See the --interval command
line option above.
timeout: microseconds
The number of microseconds to wait for a change in I/O state before
select() times out. See the --timeout command line option above.
kilobyte: 1000|1024
Use either 1000 or 1024 as the definition of a kilobyte. See the
--kilo command line option above.
block-size: size
When parsing sizes specified in terms of blocks, assume a single
block is size bytes. See the --block-size command line option above.
screen-width: width
Override termio and assume that the screen is width characters wide.
See the --screen-width command line option above.
screen-width-minus-one: boolean
Instruct bar to restrict the number of columns reported by termio by
one. See the --screen-width-minus-one command line option above.
display-twiddle: boolean
Instruct bar to turn on/off the twirling twiddle character in the
display. See the --display-twiddle command line option above.
display-title: boolean
Instruct bar to turn on/off the title in the display. See the --dis-
play-title command line option above.
display-count: boolean
Instruct bar to turn on/off the data count in the display. See the
--display-count command line option above.
display-count-bits: boolean
Display the data count as bits instead of as bytes. See the --dis-
play-count-bits command line option above.
display-throughput: boolean
Instruct bar to turn on/off the data throughput in the display. See
the --display-throughput command line option above.
display-throughput-bits: boolean
Display throughput as bits/sec instead of as bytes/sec. See the
--display-throughput-bits command line option above.
display-time: boolean
Instruct bar to turn on/off the time in the display. See the --dis-
play-time command line option above.
display-elapsed-only: boolean
Force bar to display the elapsed time instead of the eta. See the
--display-elapsed-only command line option above.
display-percent: boolean
Instruct bar to turn on/off the percent complete in the display. See
the --display-percent command line option above.
display-bar: boolean
Instruct bar to turn on/off the progress bar in the display. See the
--display-bar command line option above.
display-summary: boolean
Instruct bar to turn on/off the summary information displayed when
operation is complete. See the --display-summary command line option
above.
display-ansi: boolean
Instruct bar to turn on/off the use of ansi color codes in the dis-
play. See the --display-ansi command line option above.
space-background: color
Use color as the background color for spacing between display
objects. See the --space-background command line option above.
twiddle-foreground: color
twiddle-background: color
twiddle-bold: boolean
Use the specified colors for the foreground and background of the
twiddle, and use a bold font. See the --twiddle-foreground, --twid-
dle-background, and --twiddle-bold command line options above.
title: string
Set the title string for the display. See the --title command line
option above.
title-foreground: color
title-background: color
title-bold: boolean
Use the specified colors for the foreground and background of the
title, and use a bold font. See the --title-foreground, --title-
background, and --title-bold command line options above.
count-foreground: color
count-background: color
count-bold: boolean
Use the specified colors for the foreground and background of the
data count, and use a bold font. See the --count-foreground,
--count-background, and --count-bold command line options above.
throughput-label-foreground: color
throughput-label-background: color
throughput-label-bold: boolean
Use the specified colors for the foreground and background of the
throughput label, and use a bold font. See the --throughput-label-
foreground, --throughput-label-background, and --throughput-label-
bold command line options above.
throughput-foreground: color
throughput-background: color
throughput-bold: boolean
Use the specified colors for the foreground and background of the
throughput, and use a bold font. See the --throughput-foreground,
--throughput-background, and --throughput-bold command line options
above.
time-label-foreground: color
time-label-background: color
time-label-bold: boolean
Use the specified colors for the foreground and background of the
time label, and use a bold font. See the --time-label-foreground,
--time-label-background, and --time-label-bold command line options
above.
time-foreground: color
time-background: color
time-bold: boolean
Use the specified colors for the foreground and background of the
time, and use a bold font. See the --time-foreground, --time-back-
ground, and --time-bold command line options above.
percent-foreground: color
percent-background: color
percent-bold: boolean
Use the specified colors for the foreground and background of the
percent, and use a bold font. See the --percent-foreground, --per-
cent-background, and --percent-bold command line options above.
bar-brace-foreground: color
bar-brace-background: color
bar-brace-bold: boolean
Use the specified colors for the foreground and background of the
brace surrounding the progress bar, and use a bold font. See the
--bar-brace-foreground, --bar-brace-background, and --bar-brace-bold
command line options above.
bar-foreground: color
bar-background: color
bar-bold: boolean
Use the specified colors for the foreground and background of the
progress bar, and use a bold font. See the --bar-foreground, --bar-
background, and --bar-bold command line options above.
EXAMPLES
Example 1: Using bar to copy a 2.4gb file from a device (in this case a
tape drive) to a file, using a 64k buffer.
prompt% bar --in-file /dev/rmt/1cbn --out-file \
tape-restore.tar --size 2.4g --buffer-size 64k
Example 2: Using bar to copy a 37tb file across the network using SSH.
prompt% ssh remote 'dd if=file' | bar --size 37t > file
Example 3: Using bar inside a tar-pipe command:
Normal tar-pipe command might be:
prompt% (cd /some/dir/somewhere && tar -cf - *) \
| (cd /some/other/dir && tar -xBpf -)
3a: Using bar within the tar-pipe:
prompt% (cd /some/dir/somewhere && tar -cf - *) \
| bar \
| (cd /some/other/dir && tar -xBpf -)
3b: Using bar with the --size option in a tar-pipe:
prompt% du -sk /some/dir/somewhere
6281954 /some/dir/somewhere
prompt% (cd /some/dir/somewhere && tar -cf - *) \
| bar --size 6281954k \
| (cd /some/other/dir && tar -xBpf -)
Example 4: Using bar on a regular file. (Note that the --size option
is not needed here, as bar will retrieve the file size itself.)
prompt% bar --in-file ./file | ssh remote 'cd /some/dir && dd
of=file'
Example 5: Generating a 512k file of random data.
prompt% dd if=/dev/random bs=1024 count=512 \
| bar -s 512k -of ./random
Example 6: An example .barrc file.
#
# This is an example of what a ~/.barrc file
# might look like. Note that lines beginning
# with a # are ignored.
#
display-twiddle: no
display-ansi: yes
# space-background: black
twiddle-foreground: green
# twiddle-background: normal
# twiddle-bold: no
count-foreground: green
# count-background: magenta
count-bold: yes
throughput-label-foreground: normal
# throughput-label-background: red
throughput-label-bold: no
throughput-foreground: green
# throughput-background: black
throughput-bold: yes
time-label-foreground: normal
# time-label-background: red
time-label-bold: no
time-foreground: green
# time-background: black
time-bold: yes
percent-foreground: green
# percent-background: green
percent-bold: yes
bar-brace-foreground: red
# bar-brace-background: blue
bar-brace-bold: no
bar-foreground: yellow
# bar-background: blue
bar-bold: yes
NOTES
- The --size option is only used by bar in calculating information
about the data transfer. Bar will not cease copying data once it has
reached the number of bytes specified with the --size option, but
instead bar will continue to copy data until and end of input is
reached. If this behavior is undesirable then bar may be used in
conjunction with dd, where the count option is used with dd to spec-
ify when to cut off the input stream. (See examples above.)
- When using other commands such as du -k to calculate the expected
size of a data transfer stream, the value returned may not be exactly
the number of bytes counted by bar in the actual data transfer.
Common causes for this discrepancy could be attributed to round-off
error or the use of 1000 bytes as a kilobyte rather than 1024. (If
the later is the case, then using the -k 1000 option to bar will
help.) When such discrepancies occur, bar may report that the data
stream contained only 98% or as much as 101% of it's expected size.
(If you have doubts, you should definitely verify your data using
md5sum, diff, or cmp.)
- When the value of a calculation exceeds the size alloted for the dis-
play, the value +99... will be substituted in it's place. The com-
plete value will be displayed in a summary statement after bar has
reached the end of input.
- Bar assumes a linear relationship between the speed of the data
transfer and the amount of time remaining. Specifically the calcula-
tion is based on the following:
elapsed time / eta = bytes written / total size
However, it has been the author's experience that the throughput
speed will change, particularly at the beginning of the transfer, and
this will affect the estimated time remaining. The author does not
believe this is a bug, but a side-effect of this method of calcula-
tion.
- Bar assumes that there are 8 bits in both a byte and a char.
BUGS
- Bar uses the open() and fstat() functions to open and retrieve the
size of regular files when using either the --in-file or --out-file
command line options. Some OS's do not support Large Files (file
sizes up to (2**63)-1 bytes) natively. Some OS's support Large Files
but require _FILE_OFFSET_BITS or _LARGE_FILES to be defined properly
at compile time. Other OS's support neither, but still allow pro-
grams to open files in excess of (2**32)-1 through an O_LARGEFILE
option that can be passed to the open() function.
When trying to open files greater than 2gb on an OS without Large
File support, bar will exit with the message: "File too large". When
trying to write more than 2gb of data to a file, bar will write
2**32-1 bytes and then the OS may terminate bar with a message simi-
lar to: "File size limit exceeded".
When trying to open files greater than 2gb on an OS without Large
File support, but with the O_LARGEFILE option that can be passed to
open(), bar will receive an error when trying to retrieve the file's
size, but bar will be able to open the file anyway. Under these cir-
cumstances, bar will print a "File too large" error message, but will
then proceed to transfer the data. Since bar will not be able to
retrieve the file's size on it's own, the --size command line option
must be used after the --in-file option to tell bar the file size
manually. On such OS's, bar should be able to write more than 2gb of
data to a file without any problems.
For OS's that support files greater than 2gb, either natively or
through the Large File extension definitions mentioned above, bar
should work as expected.
- The author has noticed that when running bar over an SSH connection,
sometimes window resize events are not captured until after the dis-
play has gone through one or two more updates, which can cause the
line to wrap.
- The author has noticed that on some systems the use of aligned memory
allocation, through either memalign() or posix_memalign(), causes bar
to commit a segmentation fault the first time read() or readv() is
called and passed a pointer to the aligned memory as it's input
buffer. Attempts were made to try to isolate systems in which this
bug bites through tests in configure, but all tests devised passed
with flying colors. Therefore aligned memory allocation is turned
off by default, and may only be enabled by passing --enable-use-mema-
lign to configure when building the executable.
Report all bugs to the author.
Bar was developed on a Sun workstation running Solaris 8. To the best
of the author's knowledge bar should compile and run on other platforms
without much trouble. Should other OS's require modifications to the
code, the author welcomes all patch submissions, but requests that you
include the file config.log and the output of gcc -dumpspecs (or a
listing of predefined variables, if not using gcc).
DISTRIBUTION
The latest version of bar can always be found at:
http://www.freshmeat.net/projects/commandlineprogressbar
http://sourceforge.net/projects/clpbar/
AUTHOR
Bar was written by Michael Peek. See DISTRIBUTION above for contact
information.
Occasionally, the author fancies that he knows what he's doing. It is
at these times more than ever that his coworkers should cower in
fear...
4 November 2003 BAR(1)
Changes:
bar (1.10.5) stable; urgency=low
* Modified configure scripts:
- Now tests to find the page size of the compiling system and uses this
value by default. This can be overridden w/ --with-page-size.
- Compiles and runs tests to see if sysconf() returns a usable value. On
some systems -1 was being returned, but since the configure script found
a sysconf() function it was configuring bar to use it, but bar would
bomb with an error when it tried to use posix_memalign() w/ -1 as the
system's memory page size. So now, even if you have sysconf()
available, if sysconf() returns -1 for the page size, bar will be
configured not to use aligned memory.
- Compiles and runs tests to see if posix_memalign() is usable. In the
event of failure, separate assertions in the test code will reveal
whether posix_memalign() failed because if EINVAL, ENOMEM, or if there
was some other error. (This test could be made smarter. At the moment
the only action taken is that the configure script will log the
assertion to config.log. But it wouldn't be too hard to notify the user
of the error returned and/or take some specific action.)
- In the event that posix_memalign() checks fail, retry the test two more
times. Once defining _GNU_SOURCE and, if that fails, a second time
defining _XOPEN_SOURCE=600. I've not run accross any systems that need
these defined, but according to some man pages they may need be.
- Compiles and runs tests on aligned memory usability -- merely a
formailty at this point though. The above checks should be sufficient.
- Prints out configuration settings for the user in an easily-readable
format, so that it is obvious from the start how bar is configured to
operate. Also, some helpful text is printed on how to troubleshoot bar
and point the user to the new TROUBLESHOOTING text file.
* Fixed a reported bug in io.c's use of posix_memalign() reported by Doncho
N. Gunchev.
* New file, TROUBLESHOOTING, gives the user some things to try and
instructions on how to report bugs.
* ChangeLog is now a link to debian/changelog. All future changelog entries
will follow a debian format.
* Original changelog contents:
2005-04-01: Release 1.10.4
- Minor code change to allow bar to compile on systems without
snprintf().
2005-01-19: Release 1.10.3
- Bug sighted in ioWrite() by Chris Gentle, sank same:
avail = io.buffer_size = io.buffer_used;
Not only should this have been:
avail = io.buffer_size - io.buffer_used;
But the variable avail is not even used in ioWrite(). Shame on me for
not noticing.
The offending lines have been removed.
2004-11-23: Release 1.10.2
- Discovered the problem with memalign. Apparently memalign has two
definitions depending upon your version and flavor of OS:
memalign(size, boundary)
and
memalign(boundary, size)
New configure tests were designed, but bar still segfaults on some
systems, even after identifying which flavor of memalign to use.
Tests seem to show that using aligned memory gives less than a 1%
speed increase, so I have decided to not worry about it. The use of
memalign has been discontinued, although the use of posix_memalign is
still used if found. If posix_memalign is available, and
--disable-use-memalign has not been set, then use posix_memalign,
otherwise use malloc.
- Fixed a bug in the use of posix_memalign.
- Bar now has some default colors compiled in, in case ansi is turned on
and no colors are defined via a .barrc file.
- Removed test-args from the list of tests. The command line arguments
haven't changed in many versions now, and I have no intention of
changing them in the future.
2004-11-10: Release 1.10.1
- The strange I/O bug bit again. Tim Bynum reported an esoteric read
error under cygwin that sounded suspiciously similar to the EFAULT bug
seen earlier. With his help, I was able to track down the problem to
my use of aligned memory as an I/O buffer.
Created some elaborate tests within configure to try to reproduce the
problem so that the use of aligned memory allocation can be turned off
automatically on systems where this bug occurs:
Changed the way aligned memory was tested in the configure script:
a) Test to see if aligned memory is supported by the OS
b) If so, test to see if aligned memory works with read()/write()
c) If so, was --enable-use-memalign passed to configure
d) If so, attempt to use aligned memory allocation.
Changed the way vectored I/O was tested in the configure script:
a) Test to see if vectored I/O is supported by OS
b) If so, test to see if vectored I/O works with our chosen method of
memory allocation
c) If so, was --disable-use-iovec passed to configure
d) If not, attempt to use vectored I/O
Unfortunately, the tests pass with flying colors, while bar still fails.
Aligned memory allocation is now disabled by default. It can be enabled
by passing --enable-use-memalign to configure.
- Added a test to the configure script such that if HAVE_SYSCONF is
defined, check to see if _SC_PAGE_SIZE and _SC_PAGESIZE are defined.
Use whichever one is found.
- Spellcheck! It's a wonderful thing.
2004-11-09: Release 1.10
- The new changes to the I/O have been thoroughly tested on a number of
architectures and are believed to be safe.
2004-09-22: (development continues)
- The ring buffer seems to have problems with readv() on some
architectures. Investigating...
On the RedHat-9 system of the sourceforge compilefarm, readv() returns
an error and sets errno to EFAULT (segmentation fault) when
vec[0].iov_base > io.buffer. The only reference to EFAULT I could
find was in _UNIX System V Network Programming_, where EFAULT is said
to be set when there is a pointer problem. But the values of vec[]
have been verified as valid. On a Fedora Core 2 system this does not
happen. In fact, on no other system tested has this problem surfaced.
I'm clueless.
Therefore I am exploring the possibility of using a workaround. I
have written a configure test to check the operation of readv(). If
the problem is found then iovec I/O will be disabled and bar will use
regular read()/write() instead. The configure option
--disable-use-iovec has also been added, so that the user may override
the results of the configure test and disable the use of iovec even if
configure thinks it's safe.
2004-09-22: (development continues)
- Incorporated changes submitted by Christopher Chan-Nui to increase
throughput and decrease CPU usage. His changes include implementing a
page-aligned circular buffer in memory, and a larger default buffer
size.
The default buffer size can now be changed by passing
--with-buffer-size=SIZE when running configure. The new default buffer
size is 512K.
Changing your buffer size may or may not create a difference,
depending on your application of bar. For something fast, like I/O to
memory or to a fast hard drive, a larger buffer of say 1M might be
worth your while. But for I/O to something slow, like a tape drive,
the cost of using so much memory might not outweigh the increase in
performance.
- Chan-Nui's patch also changed the way the twiddle is updated.
Specifically it only updated the twiddle (a) if there was data written,
and (b) only when the rest of the line was updated. I decided to use a
twiddle as feedback that something was happening even for long update
delays. The problem is that on some machines, notably Linux on PC's,
the twiddle goes so fast that all it does is slam a slow terminal
connection, creating a bottleneck. Therefore I have made two changes
to the way the twiddle is updated:
1) The twiddle is turned off by default. This means that in order to
see the twiddle, you have to either specify -dtw or -da on the command
line, or you have to put "display-twiddle: yes" in the resource file.
This new default behavior can be changed by specifying
--enable-default-twiddle when running configure.
2) The twiddle will only update once a second, and then only if data
was actually copied.
- These changes have drastically increased the throughput of bar on both
SPARC and Intel architectures. As a comparison between version 1.09
and 1.10, the following throughput was seen using various buffer sizes
with the following command line:
bar -if /dev/zero -of /dev/null
Where:
bar-1.09 bar-1.10
----------------------------------- -----------------------------------
buffer | throughput buffer | throughput
size | i686-Linux E4500-Solaris size | i686-Linux E4500-Solaris
-------|------------|-------------- -------|------------|--------------
1K | 83.2MB/s | 8.4MB/s 1K | 135.2MB/s | 16.0MB/s
2K | 116.2MB/s | 11.8MB/s 2K | 269.7MB/s | 32.1MB/s
4K | 144.0MB/s | 14.1MB/s 4K | 520.7MB/s | 56.9MB/s
8K | 162.9MB/s | 15.5MB/s 8K | 973.9MB/s | 92.3MB/s
16K | 137.5MB/s | 16.4MB/s 16K | 1.4GB/s | 136.3MB/s
32K | 138.8MB/s | 16.9MB/s 32K | 2.7GB/s | 178.7MB/s
64K | 127.6MB/s | 17.2MB/s 64K | 5.0GB/s | 211.6MB/s
128K | 135.1MB/s | 17.2MB/s 128K | 9.0GB/s | 233.0MB/s
256K | 133.7MB/s | 17.3MB/s 256K | 14.8GB/s | 242.2MB/s
512K | 129.8MB/s | 17.3MB/s 512K | 22.1GB/s | 248.4MB/s
1M | 128.2MB/s | 17.3MB/s 1M | 29.2GB/s | 251.1MB/s
2M | 126.9MB/s | 17.3MB/s 2M | 35.0GB/s | 255.5MB/s
4M | 126.5MB/s | 17.1MB/s 4M | 38.0GB/s | 255.3MB/s
8M | 125.5MB/s | 17.1MB/s 8M | 39.5GB/s | 246.9MB/s
16M | 124.7MB/s | 16.2MB/s 16M | 40.6GB/s | 254.2MB/s
32M | 126.1MB/s | 16.0MB/s 32M | 40.8GB/s | 244.6MB/s
64M | 128.0MB/s | 15.5MB/s 64M | 41.2GB/s | 248.9MB/s
128M | 128.0MB/s | 15.6MB/s 128M | 41.4GB/s | 253.3MB/s
256M | 129.0MB/s | 15.6MB/s 256M | 41.9GB/s | 243.3MB/s
512M | 128.0MB/s | 14.4MB/s 512M | 40.9GB/s | 227.6MB/s
1G | 62.1MB/s | 13.5MB/s 1G | 40.9GB/s | 202.1MB/s
2004-05-27: Release 1.09
IDEAS:
- Add an option to handle multi-volume output, and display progress of
current volume. Problems to overcome:
- Automatically adjusting expected volume size:
- If no volume size is given, count the first volume and expect that
much for subsequent volume?
- If for instance you're writing to a tape drive with hardware
compression, and the volume size changes from one volume to the next
dependent on the data written, how should bar handle the expected
size of the next volume?
- Retrying a failed volume:
- Where do you store the data to be re-written?
- Knowing the difference between failed media and end-of-media?
- Should multi-volume capability be a separate program that bar pipes
to, or should I overhaul bar itself and make it vastly more
complicated?
- How to handle closing and re-opening a device between media changes:
- At the end of a volume, should bar:
- Prompt and wait for input?
- Run a program or script?
- Both (configurable)?
- When opening the next volume, should bar:
- Open the same device?
- Prompt for a new device?
- Read output from a program or script?
- Some configurable option to select one of these three?
Incorporated 'b'lock-size changes submitted by Michael T Bendzick.
Added the -bl/--block-size command line option and the "block-size"
resource file keyword to allow the user to specify the default block
size used. This option is only used in specifying the size of the
expected data stream on the command line and does not affect the I/O
routines. When specifying data size in terms of blocks the -k (size of
a kilobyte) is ignored.
Incorporated a spelling correction by Michael T Bendzick.
Added -dtp/--display-total-percent/-ntp/--no-total-percent command line
options, and the "display-total-percent" resource file keyword to allow
the user to specify that bar is not to display the total percent of
expected input in summary reports.
Fixed minor bug where the background color for a space was not
initialized. Added -ti/--title command line option and "title" resource
file keyword to specify a title to display on the status line during
data I/O. This option takes a string up to 80 characters in length
(excess characters will be truncated).
Added -dti/-nti/--display-title/--no-title command line options and the
"display-title" resource file keyword to toggle the displaying of a
title. Even if activated, nothing will be printed if no title string is
set.
Added -tifg/-tibg/-tib/-tin/--title-foreground/--title-background/
--title-bold command line options and "title-foreground",
"title-background", "title-bold" resource file options to specify the
colors used in displaying the title string.
2004-01-06: Release 1.08
Added an option to display the throughput as bits/sec instead of as
bytes/sec.
Added an option to display the the data count as bits instead of as
bytes.
2003-12-15: Release 1.07
Added an option to throttle the throughput to a given number of bytes per
second.
Modified autoconf yet again for hopefully greater portability.
Configure now assumes -sw-1 by default on *-pc-cygwin systems.
2003-12-13: Release 1.06.3
Fixed another signal handler error that would cause bar to exit with
errno == EINTR if the window size changed during a call to select().
2003-12-10: Release 1.06.2
Fixed a bug that could potentially hose the terminal: installed a signal
handler that removed O_NONBLOCK from I/O descriptors when Control-C is
pressed.
Minor cleanup of some code.
2003-12-09: Release 1.06.1
Added an option to force bar to display the elapsed time only, not the
eta.
2003-11-13: Release 1.06
Chris Gentle pointed out that bar is unable to open files greater than
2gb under Linux. Modified args.c to include O_LARGEFILE (if defined) to
open() when opening files for the --in-file and --out-file arguments.
Modified autoconf script to test for native Large File support. If that
test fails, autoconf will test to see if defining _FILE_OFFSET_BITS or
_LARGE_FILES allows bar to open and stat files greater than 2gb.
Added error.h/error.c to give more descriptive error messages when stuff
fails.
Added O_CREAT to open() for -of/--out-file option to allow bar to create
a file, and modified the creation mode for rw-rw-rw-. (Duh!)
Added #include <sys/time.h> to io.c for i686-pc-cygwin.
Added test-types.c to facilitate porting tests.
Fixed a bug in args.c number parser where the command line option --size
18446744073709551615 would produce a parse error resulting from the
inability of the parser to find the nonexistent units multiplier
character.
Tested bar on the various platforms available on the SourceForge compile
farm. See PORTING for a list. Cleaned up code and many compile
warnings on several platforms.
Modified number parser in args.c to be smart enough to recognize that "."
followed by a units multiplier is not a valid number. (Ex: -s .m)
Added resource file parsing for ~/.barrc and ./.barrc. Required
revamping argument parsing in args.c.
Fixed a bug in test-args.c whereby test110() would fail on line 15321 on
systems where size_t is 8 bytes instead of 4.
2003-11-04: Release 1.05
Chris Gentle supplied a patch for the --no-summary command line option.
Added code to query the terminal to find the terminal width and to update
itself when the terminal size changes.
Rewrote command line parsing algorithms for cleaner code. Fixed an error
when parsing fractional size arguments. (i.e. "<x>.<y>" numbers, such as
"1.38m".)
Ran ispell on the stupid manual page.
2003-10-31: Release 1.04
Chris Gentle supplied a patch for the --no-time command line option.
Updated display code to include petabyte (2^50) and exabyte (2^60) in
addition to kilo, mega, giga, and tera.
Updated command line argument parser to include 'P'etabyte and 'E'xabyte
modifiers to size arguments.
Added -n* and --no-* command line options to turn off pieces of the
display.
Added -d* and --display-* command line options to turn on pieces of the
display.
Added -sw and --screen-width command line options to allow the user to
set the width of the display.
Added types.h and supporting autoconf tests for type uint64.
Updated man page.
2003-09-09: Release 1.03
Anand Mitra supplied modifications that drastically reduced CPU usage.
Minor code restructuring for optimization.
Minor changes to autoconf scripts and code, (hopefully) to make bar more
portable.
Introduced a manual page.
Introduced command line option -t / --timeout as a way to specify the
number of microseconds select() is to wait for a change in I/O.
Reversed the order of the ChangeLog file so most recent changes appear
first. (Duh.)
One more minor bug fix to the display code.
2003-08-20: Release 1.02
Minor bug fix to autoconf.
2003-08-18: Release 1.01
Minor bug fixes in the display algorithms.
2003-08-14: Release 1.0
Initial release.
# vim:et:ts=2:shiftwidth=2
-- Michael S. Peek <peek@tiem.utk.edu> Fri, 10 Mar 2006 09:50:48 -0500
bar (1.10.4) stable; urgency=low
* Initial Release.
-- Michael Peek <peek@tiem.utk.edu> Thu, 16 Jun 2005 13:50:15 -0400
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use