[llvm-commits] CVS: llvm/include/Support/SlowOperationInformer.h

Chris Lattner lattner at cs.uiuc.edu
Wed Dec 31 04:21:01 PST 2003


Changes in directory llvm/include/Support:

SlowOperationInformer.h updated: 1.2 -> 1.3

---
Log message:

* 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%


---
Diffs of the changes:  (+10 -0)

Index: llvm/include/Support/SlowOperationInformer.h
diff -u llvm/include/Support/SlowOperationInformer.h:1.2 llvm/include/Support/SlowOperationInformer.h:1.3
--- llvm/include/Support/SlowOperationInformer.h:1.2	Tue Dec 30 23:45:16 2003
+++ llvm/include/Support/SlowOperationInformer.h	Wed Dec 31 04:20:37 2003
@@ -32,6 +32,7 @@
 #define SUPPORT_SLOW_OPERATION_INFORMER_H
 
 #include <string>
+#include <cassert>
 
 namespace llvm {
   class SlowOperationInformer {
@@ -49,6 +50,15 @@
     /// 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
 





More information about the llvm-commits mailing list