mbackes@symas.com wrote:
Full_Name: Matthew Backes Version: 2.4, head OS: any URL: Submission from: (NULL) (76.88.99.93)
Here is a proposal for a progress bar reporting tool, to appear in slapadd and other long running tools. A similar version was used previously in Symas's OpenLDAP 2.3 (CDS3) product. This version is significantly more modular, so that alternative estimators and display systems may be added.
By default, it displays a text bar showing activity, progress, percent completion, estimated time to completion, elapsed time, and speed in bytes of ldif per second.
The display functions are modular so that we could add a running trace of numbers that a graphical front-end might read and transform into pretty animated pie charts, or potentially fancier display within these tools.
The default (and only) supplied display system currently relies only on carriage return, with no external libraries needed or dependencies on terminal features.
Estimators are modular as well, as the default linear estimator can be frustratingly poor for very large, poorly tuned databases with extremely non-linear load times.
Progress is estimated by fstat()ing the ldif file and ftell()ing to see the position. As a result, ldif read from stdin automatically disables the progress bar.
Files are available at:
http://lirone.symas.net/lucca/progress-bar/
- Apply progress.patch
- Copy progress.c into libraries/liblutil/progress.c
- Copy progress.h into include/progress.h
progress seems a bit too generic; the names probably should be prefixed with lutil. Also I suggest using "meter" instead of "progress".
lutil-meter.h, meter.c.
We should probably make this configurable via the commandline (on/off, as well as which display and estimator systems to use), but currently it is always on provided stderr is a tty and the ldif is a file.