158
159 const size_t K = 1024;
160 const size_t M = K*K;
161 const size_t G = M*K;
162 const size_t HWperKB = K / sizeof(HeapWord);
163
164 const size_t LOG_K = 10;
165 const size_t LOG_M = 2 * LOG_K;
166 const size_t LOG_G = 2 * LOG_M;
167
168 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint
169 const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint
170
171 // Constants for converting from a base unit to milli-base units. For
172 // example from seconds to milliseconds and microseconds
173
174 const int MILLIUNITS = 1000; // milli units per base unit
175 const int MICROUNITS = 1000000; // micro units per base unit
176 const int NANOUNITS = 1000000000; // nano units per base unit
177
178 inline const char* proper_unit_for_byte_size(size_t s) {
179 if (s >= 10*M) {
180 return "M";
181 } else if (s >= 10*K) {
182 return "K";
183 } else {
184 return "B";
185 }
186 }
187
188 inline size_t byte_size_in_proper_unit(size_t s) {
189 if (s >= 10*M) {
190 return s/M;
191 } else if (s >= 10*K) {
192 return s/K;
193 } else {
194 return s;
195 }
196 }
197
|
158
159 const size_t K = 1024;
160 const size_t M = K*K;
161 const size_t G = M*K;
162 const size_t HWperKB = K / sizeof(HeapWord);
163
164 const size_t LOG_K = 10;
165 const size_t LOG_M = 2 * LOG_K;
166 const size_t LOG_G = 2 * LOG_M;
167
168 const jint min_jint = (jint)1 << (sizeof(jint)*BitsPerByte-1); // 0x80000000 == smallest jint
169 const jint max_jint = (juint)min_jint - 1; // 0x7FFFFFFF == largest jint
170
171 // Constants for converting from a base unit to milli-base units. For
172 // example from seconds to milliseconds and microseconds
173
174 const int MILLIUNITS = 1000; // milli units per base unit
175 const int MICROUNITS = 1000000; // micro units per base unit
176 const int NANOUNITS = 1000000000; // nano units per base unit
177
178 const jlong NANOSECS_PER_SEC = CONST64(1000000000);
179 const jint NANOSECS_PER_MILLISEC = 1000000;
180
181 inline const char* proper_unit_for_byte_size(size_t s) {
182 if (s >= 10*M) {
183 return "M";
184 } else if (s >= 10*K) {
185 return "K";
186 } else {
187 return "B";
188 }
189 }
190
191 inline size_t byte_size_in_proper_unit(size_t s) {
192 if (s >= 10*M) {
193 return s/M;
194 } else if (s >= 10*K) {
195 return s/K;
196 } else {
197 return s;
198 }
199 }
200
|