< prev index next >

src/hotspot/os/windows/os_windows.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1590 void os::win32::print_uptime_info(outputStream* st) {
1591   unsigned long long ticks = GetTickCount64();
1592   os::print_dhm(st, "OS uptime:", ticks/1000);
1593 }
1594 
1595 void os::print_os_info(outputStream* st) {
1596 #ifdef ASSERT
1597   char buffer[1024];
1598   st->print("HostName: ");
1599   if (get_host_name(buffer, sizeof(buffer))) {
1600     st->print("%s ", buffer);
1601   } else {
1602     st->print("N/A ");
1603   }
1604 #endif
1605   st->print("OS:");
1606   os::win32::print_windows_version(st);
1607 
1608   os::win32::print_uptime_info(st);
1609 
1610 #ifdef _LP64
1611   VM_Version::print_platform_virtualization_info(st);
1612 #endif
1613 }
1614 
1615 void os::win32::print_windows_version(outputStream* st) {
1616   OSVERSIONINFOEX osvi;
1617   VS_FIXEDFILEINFO *file_info;
1618   TCHAR kernel32_path[MAX_PATH];
1619   UINT len, ret;
1620 
1621   // Use the GetVersionEx information to see if we're on a server or
1622   // workstation edition of Windows. Starting with Windows 8.1 we can't
1623   // trust the OS version information returned by this API.
1624   ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1625   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1626   if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
1627     st->print_cr("Call to GetVersionEx failed");
1628     return;
1629   }
1630   bool is_workstation = (osvi.wProductType == VER_NT_WORKSTATION);
1631 
1632   // Get the full path to \Windows\System32\kernel32.dll and use that for


   1 /*
   2  * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1590 void os::win32::print_uptime_info(outputStream* st) {
1591   unsigned long long ticks = GetTickCount64();
1592   os::print_dhm(st, "OS uptime:", ticks/1000);
1593 }
1594 
1595 void os::print_os_info(outputStream* st) {
1596 #ifdef ASSERT
1597   char buffer[1024];
1598   st->print("HostName: ");
1599   if (get_host_name(buffer, sizeof(buffer))) {
1600     st->print("%s ", buffer);
1601   } else {
1602     st->print("N/A ");
1603   }
1604 #endif
1605   st->print("OS:");
1606   os::win32::print_windows_version(st);
1607 
1608   os::win32::print_uptime_info(st);
1609 

1610   VM_Version::print_platform_virtualization_info(st);

1611 }
1612 
1613 void os::win32::print_windows_version(outputStream* st) {
1614   OSVERSIONINFOEX osvi;
1615   VS_FIXEDFILEINFO *file_info;
1616   TCHAR kernel32_path[MAX_PATH];
1617   UINT len, ret;
1618 
1619   // Use the GetVersionEx information to see if we're on a server or
1620   // workstation edition of Windows. Starting with Windows 8.1 we can't
1621   // trust the OS version information returned by this API.
1622   ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1623   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1624   if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
1625     st->print_cr("Call to GetVersionEx failed");
1626     return;
1627   }
1628   bool is_workstation = (osvi.wProductType == VER_NT_WORKSTATION);
1629 
1630   // Get the full path to \Windows\System32\kernel32.dll and use that for


< prev index next >