comparison src/share/vm/utilities/globalDefinitions.hpp @ 6063:cdfa5139bd58

7169056: Add gigabyte unit to proper_unit_for_byte_size() and byte_size_in_proper_unit() Reviewed-by: jwilhelm, johnc, dholmes
author brutisso
date Tue, 15 May 2012 22:26:37 +0200
parents 3a22b77e755a
children 5c8bd7c16119
comparison
equal deleted inserted replaced
6062:1096fc5a52eb 6063:cdfa5139bd58
177 177
178 const jlong NANOSECS_PER_SEC = CONST64(1000000000); 178 const jlong NANOSECS_PER_SEC = CONST64(1000000000);
179 const jint NANOSECS_PER_MILLISEC = 1000000; 179 const jint NANOSECS_PER_MILLISEC = 1000000;
180 180
181 inline const char* proper_unit_for_byte_size(size_t s) { 181 inline const char* proper_unit_for_byte_size(size_t s) {
182 #ifdef _LP64
183 if (s >= 10*G) {
184 return "G";
185 }
186 #endif
182 if (s >= 10*M) { 187 if (s >= 10*M) {
183 return "M"; 188 return "M";
184 } else if (s >= 10*K) { 189 } else if (s >= 10*K) {
185 return "K"; 190 return "K";
186 } else { 191 } else {
188 } 193 }
189 } 194 }
190 195
191 template <class T> 196 template <class T>
192 inline T byte_size_in_proper_unit(T s) { 197 inline T byte_size_in_proper_unit(T s) {
198 #ifdef _LP64
199 if (s >= 10*G) {
200 return (T)(s/G);
201 }
202 #endif
193 if (s >= 10*M) { 203 if (s >= 10*M) {
194 return (T)(s/M); 204 return (T)(s/M);
195 } else if (s >= 10*K) { 205 } else if (s >= 10*K) {
196 return (T)(s/K); 206 return (T)(s/K);
197 } else { 207 } else {