7169056: Add gigabyte unit to proper_unit_for_byte_size() and byte_size_in_proper_unit()

Tue, 15 May 2012 22:26:37 +0200

author
brutisso
date
Tue, 15 May 2012 22:26:37 +0200
changeset 3766
cdfa5139bd58
parent 3765
1096fc5a52eb
child 3767
9d679effd28c

7169056: Add gigabyte unit to proper_unit_for_byte_size() and byte_size_in_proper_unit()
Reviewed-by: jwilhelm, johnc, dholmes

src/share/vm/utilities/globalDefinitions.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Tue May 15 09:49:18 2012 -0700
     1.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Tue May 15 22:26:37 2012 +0200
     1.3 @@ -179,6 +179,11 @@
     1.4  const jint  NANOSECS_PER_MILLISEC = 1000000;
     1.5  
     1.6  inline const char* proper_unit_for_byte_size(size_t s) {
     1.7 +#ifdef _LP64
     1.8 +  if (s >= 10*G) {
     1.9 +    return "G";
    1.10 +  }
    1.11 +#endif
    1.12    if (s >= 10*M) {
    1.13      return "M";
    1.14    } else if (s >= 10*K) {
    1.15 @@ -190,6 +195,11 @@
    1.16  
    1.17  template <class T>
    1.18  inline T byte_size_in_proper_unit(T s) {
    1.19 +#ifdef _LP64
    1.20 +  if (s >= 10*G) {
    1.21 +    return (T)(s/G);
    1.22 +  }
    1.23 +#endif
    1.24    if (s >= 10*M) {
    1.25      return (T)(s/M);
    1.26    } else if (s >= 10*K) {

mercurial