308 ? VMNAME " (" INTERNAL_VERSION_SUFFIX
309 : VMNAME " (" DEBUG_LEVEL " " INTERNAL_VERSION_SUFFIX;
310 }
311
312 const char *Abstract_VM_Version::jdk_debug_level() {
313 return DEBUG_LEVEL;
314 }
315
316 const char *Abstract_VM_Version::printable_jdk_debug_level() {
317 // Debug level is not printed for "release" builds
318 return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " ";
319 }
320
321 unsigned int Abstract_VM_Version::jvm_version() {
322 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
323 ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
324 ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
325 (Abstract_VM_Version::vm_build_number() & 0xFF);
326 }
327
328 const char* Abstract_VM_Version::extract_features_string(const char* cpu_info_string,
329 size_t cpu_info_string_len,
330 size_t features_offset) {
331 assert(features_offset <= cpu_info_string_len, "");
332 if (features_offset < cpu_info_string_len) {
333 assert(cpu_info_string[features_offset + 0] == ',', "");
334 assert(cpu_info_string[features_offset + 1] == ' ', "");
335 return cpu_info_string + features_offset + 2; // skip initial ", "
336 } else {
337 return ""; // empty
338 }
339 }
340
341 bool Abstract_VM_Version::print_matching_lines_from_file(const char* filename, outputStream* st, const char* keywords_to_match[]) {
342 char line[500];
343 FILE* fp = os::fopen(filename, "r");
344 if (fp == nullptr) {
345 return false;
346 }
347
348 st->print_cr("Virtualization information:");
349 while (fgets(line, sizeof(line), fp) != nullptr) {
350 int i = 0;
351 while (keywords_to_match[i] != nullptr) {
352 if (strncmp(line, keywords_to_match[i], strlen(keywords_to_match[i])) == 0) {
353 st->print("%s", line);
354 break;
355 }
356 i++;
357 }
358 }
359 fclose(fp);
360 return true;
|
308 ? VMNAME " (" INTERNAL_VERSION_SUFFIX
309 : VMNAME " (" DEBUG_LEVEL " " INTERNAL_VERSION_SUFFIX;
310 }
311
312 const char *Abstract_VM_Version::jdk_debug_level() {
313 return DEBUG_LEVEL;
314 }
315
316 const char *Abstract_VM_Version::printable_jdk_debug_level() {
317 // Debug level is not printed for "release" builds
318 return strcmp(DEBUG_LEVEL, "release") == 0 ? "" : DEBUG_LEVEL " ";
319 }
320
321 unsigned int Abstract_VM_Version::jvm_version() {
322 return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
323 ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
324 ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
325 (Abstract_VM_Version::vm_build_number() & 0xFF);
326 }
327
328 bool Abstract_VM_Version::print_matching_lines_from_file(const char* filename, outputStream* st, const char* keywords_to_match[]) {
329 char line[500];
330 FILE* fp = os::fopen(filename, "r");
331 if (fp == nullptr) {
332 return false;
333 }
334
335 st->print_cr("Virtualization information:");
336 while (fgets(line, sizeof(line), fp) != nullptr) {
337 int i = 0;
338 while (keywords_to_match[i] != nullptr) {
339 if (strncmp(line, keywords_to_match[i], strlen(keywords_to_match[i])) == 0) {
340 st->print("%s", line);
341 break;
342 }
343 i++;
344 }
345 }
346 fclose(fp);
347 return true;
|