src/hotspot/share/runtime/vm_version.cpp
changeset 54485 ddc19ea5059c
parent 53723 f31dad87f661
child 54786 ebf733a324d4
equal deleted inserted replaced
54484:72f05350b4b3 54485:ddc19ea5059c
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    41 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
    41 bool Abstract_VM_Version::_supports_atomic_getset8 = false;
    42 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
    42 bool Abstract_VM_Version::_supports_atomic_getadd4 = false;
    43 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
    43 bool Abstract_VM_Version::_supports_atomic_getadd8 = false;
    44 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
    44 unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U;
    45 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
    45 unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0;
       
    46 
       
    47 VirtualizationType Abstract_VM_Version::_detected_virtualization = NoDetectedVirtualization;
    46 
    48 
    47 #ifndef HOTSPOT_VERSION_STRING
    49 #ifndef HOTSPOT_VERSION_STRING
    48   #error HOTSPOT_VERSION_STRING must be defined
    50   #error HOTSPOT_VERSION_STRING must be defined
    49 #endif
    51 #endif
    50 
    52 
   293          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
   295          ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
   294          ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
   296          ((Abstract_VM_Version::vm_security_version() & 0xFF) << 8) |
   295          (Abstract_VM_Version::vm_build_number() & 0xFF);
   297          (Abstract_VM_Version::vm_build_number() & 0xFF);
   296 }
   298 }
   297 
   299 
   298 
       
   299 void VM_Version_init() {
   300 void VM_Version_init() {
   300   VM_Version::initialize();
   301   VM_Version::initialize();
   301 
   302 
   302   if (log_is_enabled(Info, os, cpu)) {
   303   if (log_is_enabled(Info, os, cpu)) {
   303     char buf[1024];
   304     char buf[1024];
   304     ResourceMark rm;
   305     ResourceMark rm;
   305     LogStream ls(Log(os, cpu)::info());
   306     LogStream ls(Log(os, cpu)::info());
   306     os::print_cpu_info(&ls, buf, sizeof(buf));
   307     os::print_cpu_info(&ls, buf, sizeof(buf));
   307   }
   308   }
   308 }
   309 }
       
   310 
       
   311 bool Abstract_VM_Version::print_matching_lines_from_file(const char* filename, outputStream* st, const char* keywords_to_match[]) {
       
   312   char line[500];
       
   313   FILE* fp = fopen(filename, "r");
       
   314   if (fp == NULL) {
       
   315     return false;
       
   316   }
       
   317 
       
   318   st->print_cr("Virtualization information:");
       
   319   while (fgets(line, sizeof(line), fp) != NULL) {
       
   320     int i = 0;
       
   321     while (keywords_to_match[i] != NULL) {
       
   322       if (strncmp(line, keywords_to_match[i], strlen(keywords_to_match[i])) == 0) {
       
   323         st->print("%s", line);
       
   324         break;
       
   325       }
       
   326       i++;
       
   327     }
       
   328   }
       
   329   fclose(fp);
       
   330   return true;
       
   331 }
       
   332 
       
   333