aboutsummaryrefslogtreecommitdiffstats
path: root/include/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-31 10:20:38 +0000
committerChris Lattner <sabre@nondot.org>2003-12-31 10:20:38 +0000
commit9e26027b82e70308151e129fdddb12ee85dd82c5 (patch)
tree0689e969602bbc9ab222b07bfbdf85e83abff464 /include/Support
parent60837821e2bb179c6dd239ecb4d72df37560d3bb (diff)
downloadexternal_llvm-9e26027b82e70308151e129fdddb12ee85dd82c5.zip
external_llvm-9e26027b82e70308151e129fdddb12ee85dd82c5.tar.gz
external_llvm-9e26027b82e70308151e129fdddb12ee85dd82c5.tar.bz2
* Add a new helper progress method
* Make sure that the user sees the 100% mark * Don't bother printing out X.0%, just print out X% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/Support')
-rw-r--r--include/Support/SlowOperationInformer.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/Support/SlowOperationInformer.h b/include/Support/SlowOperationInformer.h
index 75c5796..67edf7d 100644
--- a/include/Support/SlowOperationInformer.h
+++ b/include/Support/SlowOperationInformer.h
@@ -32,6 +32,7 @@
#define SUPPORT_SLOW_OPERATION_INFORMER_H
#include <string>
+#include <cassert>
namespace llvm {
class SlowOperationInformer {
@@ -49,6 +50,15 @@ namespace llvm {
/// along the operation is, given in 1/10ths of a percent (in other words,
/// Amount should range from 0 to 1000).
void progress(unsigned Amount);
+
+ /// progress - Same as the method above, but this performs the division for
+ /// you, and helps you avoid overflow if you are dealing with largish
+ /// numbers.
+ void progress(unsigned Current, unsigned Maximum) {
+ assert(Maximum != 0 &&
+ "Shouldn't be doing work if there is nothing to do!");
+ progress(Current*1000ULL/Maximum);
+ }
};
} // end namespace llvm