Menu

Tree [49edf1] master /
 History

HTTPS access


File Date Author Commit
 html 2012-06-30 rsz rsz [49edf1] Added tarball upload command to readme.
 MIT-LICENSE 2012-06-04 rsz rsz [f8c847] Initial commit.
 Makefile 2012-06-30 rsz rsz [69ee84] Fixed license and added highlighting into readme.
 README.md 2012-06-30 rsz rsz [49edf1] Added tarball upload command to readme.
 etaExample.cpp 2012-06-04 rsz rsz [f8c847] Initial commit.
 example.cpp 2012-06-04 rsz rsz [f8c847] Initial commit.
 ezETAProgressBar.hpp 2012-06-30 rsz rsz [69ee84] Fixed license and added highlighting into readme.
 ezProgressBar.hpp 2012-06-30 rsz rsz [69ee84] Fixed license and added highlighting into readme.
 ezRateProgressBar.hpp 2012-06-30 rsz rsz [69ee84] Fixed license and added highlighting into readme.
 rateExample.cpp 2012-06-04 rsz rsz [f8c847] Initial commit.
 test.cpp 2012-06-04 rsz rsz [f8c847] Initial commit.
 test.truth 2012-06-04 rsz rsz [f8c847] Initial commit.

Read Me

Overview

ezProgressBar is now 3 C++ progress classes with different output styles (ezProgressBar, ezETAProgressBar and ezRateProgressBar).

They've been compiled and tested with the latest Ubuntu Linux (g++) and Cygwin (g++) in MS Windows 7.


Features

  • Prints either on one line up to 52 characters (ezProgressBar) or custom width (ezETAProgressBar).
  • Time average performance information (ezRateProgressBar).
  • Only depends on the standard iostream class.
  • Tiny download and no linking due to single header file implementations.
  • MIT license.
  • Minimal learning curve due to examples.
  • Regression tested and memory tested with valgrind.

Examples

ezProgressBar

ezProgressBar is an easy-to-use C++ progress bar class that efficiently prints a single line without carriage returns, so it's ideal for programs that redirect output to a file (otherwise your file would be polluted with numerous lines of progress). It uses a single header file and only depends on the standard iostream. Each dot appears at 2.5 percent intervals, and there are no strings before or after it so you can customize it with labels and messages when it's done. This was inspired by the progress message in the GDAL GIS utilities. It looks like this when complete:


0...10...20...30...40...50...60...70...80...90...100

This would create the example:

#include "ezProgressBar.hpp"

#ifdef WIN32
  #include <windows.h>
#else
  #include <unistd.h>
#endif

int main() {
  int n = 100;
  ez::ezProgressBar p(n);
  p.start();

  for(int i=0; i <= n; ++i, ++p) {
    #ifdef WIN32
      Sleep(1000);
    #else
      sleep(1);
    #endif
  }

  return 0;
}

ezETAProgressBar

ezETAProgressBar is a more traditional growing progress bar that reports a percentage and a time-remaining estimate, from the moment it was invoked. The bar fits on one-line, but uses an overwriting carriage-return to reprint itself. This is how it looks:


 90% [################################################      ] ETA 1d 3h 46m 34s

This would create the example:

#include "ezETAProgressBar.hpp"

#ifdef WIN32
  #include <windows.h>
#else
  #include <unistd.h>
#endif

int main() {
  int n = 10;
  ez::ezETAProgressBar p(n);
  p.start();

  for(int i=0; i <= n; ++i, ++p) {
    #ifdef WIN32
      Sleep(1000);
    #else
      sleep(1);
    #endif
  }

  return 0;
}

ezRateProgressBar

The most advanced and informative is ezRateProgressBar. It reports percentage complete, the time that has elapsed and estimated remainder, plus how many tasks have been done and remain. The rate reported is just an average. The units label can be defined in your code. It looks like this:


Done |  Elapsed | Remaining | Processed | Unprocessed | Rate
 40% | 00:04:00 |  00:06:00 |  4,000 MB |    6,000 MB | 17 MB/s 

This would create the example:

#include "ezRateProgressBar.hpp"

#ifdef WIN32
  #include <windows.h>
#else
  #include <unistd.h>
#endif

int main() {
  int n = 1000;
  ez::ezRateProgressBar<int> p(n);
  p.units = "MB";
  p.start();

  for(int i=0; i <= n; i += 100) {
    p.update(i);
    #ifdef WIN32
      Sleep(1000);
    #else
      sleep(1);
    #endif
  }

  return 0;
}

Download

Source Code, Examples and Tests


Testing

make

Installation

sudo make install PREFIX=/usr/local

Distribution

make html
make clean
make dist VER=2.1.0

Publishing

ssh -t rsz,ezprogressbar@shell.sourceforge.net create
scp html/*.html ez*Bar.hpp rsz,ezprogressbar@shell.sourceforge.net:/home/project-web/ezprogressbar/htdocs
scp ../ezProgressBar-2.1.1.tar.gz rsz,ezprogressbar@shell.sourceforge.net:/home/frs/project/e/ez/ezprogressbar

Changelog

2.1.1 20120630

  • Added syntax highlighting to markdown output.
  • Fixed licenses in files.

License

Copyright (C) 2011,2012 Remik Ziemlinski. See MIT-LICENSE.


SourceForge.net Logo

<link rel="stylesheet" href="http://yandex.st/highlightjs/7.0/styles/default.min.css">

<script src="http://yandex.st/highlightjs/7.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.