< prev index next >

src/hotspot/share/utilities/ostream.hpp

Print this page
rev 49895 : [mq]: 8201572-improve-metaspace-reporting

@@ -100,12 +100,24 @@
    void print_raw_cr(const char* str, int len){ write(str,         len); cr(); }
    void print_data(void* data, size_t len, bool with_ascii);
    void put(char ch);
    void sp(int count = 1);
    void cr();
+   void cr_indent();
    void bol() { if (_position > 0)  cr(); }
 
+   // Print a human readable size.
+   // byte_size: size, in bytes, to be printed.
+   // scale: one of 1 (byte-wise printing), sizeof(word) (word-size printing), K, M, G (scaled by KB, MB, GB respectively,
+   //         or 0, which means the best scale is choosen dynamically.
+   // width: printing width.
+   void print_human_readable_size(size_t byte_size, size_t scale = 0, int width = -1);
+
+   // Prints a percentage value. Values smaller than 1% but not 0 are displayed as "<1%", values
+   // larger than 99% but not 100% are displayed as ">100%".
+   void print_percentage(size_t total, size_t part);
+
    // Time stamp
    TimeStamp& time_stamp() { return _stamp; }
    void stamp();
    void stamp(bool guard, const char* prefix, const char* suffix);
    void stamp(bool guard) {

@@ -150,11 +162,10 @@
     _str->inc(_amount);
   }
   ~streamIndentor() { _str->dec(_amount); }
 };
 
-
 // advisory locking for the shared tty stream:
 class ttyLocker: StackObj {
   friend class ttyUnlocker;
  private:
   intx _holder;
< prev index next >