src/os/windows/vm/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8026324.01 Sdiff src/os/windows/vm

src/os/windows/vm/os_windows.cpp

Print this page




1576       filename[0] = '\0';
1577     }
1578 
1579     MODULEINFO modinfo;
1580     if (!os::PSApiDll::GetModuleInformation(hProcess, modules[i],
1581                                             &modinfo, sizeof(modinfo))) {
1582       modinfo.lpBaseOfDll = NULL;
1583       modinfo.SizeOfImage = 0;
1584     }
1585 
1586     // Invoke callback function
1587     result = callback(filename, (address)modinfo.lpBaseOfDll,
1588                       (address)((u8)modinfo.lpBaseOfDll + (u8)modinfo.SizeOfImage), param);
1589     if (result) break;
1590   }
1591 
1592   CloseHandle(hProcess);
1593   return result;
1594 }
1595 















1596 void os::print_os_info_brief(outputStream* st) {
1597   os::print_os_info(st);
1598 }
1599 
1600 void os::print_os_info(outputStream* st) {
1601 #ifdef ASSERT
1602   char buffer[1024];
1603   DWORD size = sizeof(buffer);
1604   st->print(" HostName: ");
1605   if (GetComputerNameEx(ComputerNameDnsHostname, buffer, &size)) {
1606     st->print("%s", buffer);
1607   } else {
1608     st->print("N/A");
1609   }
1610 #endif
1611   st->print(" OS:");
1612   os::win32::print_windows_version(st);
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 


1719     st->print("%d.%d", major_version, minor_version);
1720     break;
1721   }
1722 
1723   // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
1724   // find out whether we are running on 64 bit processor or not
1725   SYSTEM_INFO si;
1726   ZeroMemory(&si, sizeof(SYSTEM_INFO));
1727   os::Kernel32Dll::GetNativeSystemInfo(&si);
1728   if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
1729     st->print(" , 64 bit");
1730   }
1731 
1732   st->print(" Build %d", build_number);
1733   st->print(" (%d.%d.%d.%d)", major_version, minor_version, build_number, build_minor);
1734   st->cr();
1735 }
1736 
1737 void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
1738   // Nothing to do for now.

















1739 }
1740 
1741 void os::print_memory_info(outputStream* st) {
1742   st->print("Memory:");
1743   st->print(" %dk page", os::vm_page_size()>>10);
1744 
1745   // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
1746   // value if total memory is larger than 4GB
1747   MEMORYSTATUSEX ms;
1748   ms.dwLength = sizeof(ms);
1749   GlobalMemoryStatusEx(&ms);
1750 
1751   st->print(", physical %uk", os::physical_memory() >> 10);
1752   st->print("(%uk free)", os::available_memory() >> 10);
1753 
1754   st->print(", swap %uk", ms.ullTotalPageFile >> 10);
1755   st->print("(%uk free)", ms.ullAvailPageFile >> 10);
1756   st->cr();
1757 }
1758 




1576       filename[0] = '\0';
1577     }
1578 
1579     MODULEINFO modinfo;
1580     if (!os::PSApiDll::GetModuleInformation(hProcess, modules[i],
1581                                             &modinfo, sizeof(modinfo))) {
1582       modinfo.lpBaseOfDll = NULL;
1583       modinfo.SizeOfImage = 0;
1584     }
1585 
1586     // Invoke callback function
1587     result = callback(filename, (address)modinfo.lpBaseOfDll,
1588                       (address)((u8)modinfo.lpBaseOfDll + (u8)modinfo.SizeOfImage), param);
1589     if (result) break;
1590   }
1591 
1592   CloseHandle(hProcess);
1593   return result;
1594 }
1595 
1596 #ifndef PRODUCT
1597 bool os::get_host_name(char* buf, size_t buflen) {
1598   DWORD size = (DWORD)buflen;
1599   return (GetComputerNameEx(ComputerNameDnsHostname, buf, &size) == TRUE);
1600 }
1601 #endif // PRODUCT
1602 
1603 void os::get_summary_os_info(char* buf, size_t buflen) {
1604   stringStream sst(buf, buflen);
1605   os::win32::print_windows_version(&sst);
1606   // chop off newline character
1607   char* nl = strchr(buf, '\n');
1608   if (nl != NULL) *nl = '\0';
1609 }
1610 
1611 void os::print_os_info_brief(outputStream* st) {
1612   os::print_os_info(st);
1613 }
1614 
1615 void os::print_os_info(outputStream* st) {
1616 #ifdef ASSERT
1617   char buffer[1024];
1618   DWORD size = sizeof(buffer);
1619   st->print("HostName: ");
1620   if (GetComputerNameEx(ComputerNameDnsHostname, buffer, &size)) {
1621     st->print("%s ", buffer);
1622   } else {
1623     st->print("N/A ");
1624   }
1625 #endif
1626   st->print("OS:");
1627   os::win32::print_windows_version(st);
1628 }
1629 
1630 void os::win32::print_windows_version(outputStream* st) {
1631   OSVERSIONINFOEX osvi;
1632   VS_FIXEDFILEINFO *file_info;
1633   TCHAR kernel32_path[MAX_PATH];
1634   UINT len, ret;
1635 
1636   // Use the GetVersionEx information to see if we're on a server or
1637   // workstation edition of Windows. Starting with Windows 8.1 we can't
1638   // trust the OS version information returned by this API.
1639   ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1640   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1641   if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
1642     st->print_cr("Call to GetVersionEx failed");
1643     return;
1644   }
1645   bool is_workstation = (osvi.wProductType == VER_NT_WORKSTATION);
1646 


1734     st->print("%d.%d", major_version, minor_version);
1735     break;
1736   }
1737 
1738   // Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
1739   // find out whether we are running on 64 bit processor or not
1740   SYSTEM_INFO si;
1741   ZeroMemory(&si, sizeof(SYSTEM_INFO));
1742   os::Kernel32Dll::GetNativeSystemInfo(&si);
1743   if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
1744     st->print(" , 64 bit");
1745   }
1746 
1747   st->print(" Build %d", build_number);
1748   st->print(" (%d.%d.%d.%d)", major_version, minor_version, build_number, build_minor);
1749   st->cr();
1750 }
1751 
1752 void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
1753   // Nothing to do for now.
1754 }
1755 
1756 void os::get_summary_cpu_info(char* buf, size_t buflen) {
1757   HKEY key;
1758   DWORD status = RegOpenKey(HKEY_LOCAL_MACHINE,
1759                "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &key);
1760   if (status == ERROR_SUCCESS) {
1761     DWORD size = (DWORD)buflen;
1762     status = RegQueryValueEx(key, "ProcessorNameString", NULL, NULL, (byte*)buf, &size);
1763     if (status != ERROR_SUCCESS) {
1764         strncpy(buf, "## __CPU__", buflen);
1765     }
1766     RegCloseKey(key);
1767   } else {
1768     // Put generic cpu info to return
1769     strncpy(buf, "## __CPU__", buflen);
1770   }
1771 }
1772 
1773 void os::print_memory_info(outputStream* st) {
1774   st->print("Memory:");
1775   st->print(" %dk page", os::vm_page_size()>>10);
1776 
1777   // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
1778   // value if total memory is larger than 4GB
1779   MEMORYSTATUSEX ms;
1780   ms.dwLength = sizeof(ms);
1781   GlobalMemoryStatusEx(&ms);
1782 
1783   st->print(", physical %uk", os::physical_memory() >> 10);
1784   st->print("(%uk free)", os::available_memory() >> 10);
1785 
1786   st->print(", swap %uk", ms.ullTotalPageFile >> 10);
1787   st->print("(%uk free)", ms.ullAvailPageFile >> 10);
1788   st->cr();
1789 }
1790 


src/os/windows/vm/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File