< prev index next >

src/hotspot/os/windows/os_windows.cpp

Print this page
rev 50160 : 8202427: Enhance os::print_memory_info on Windows


1697     if (status != ERROR_SUCCESS) {
1698         strncpy(buf, "## __CPU__", buflen);
1699     }
1700     RegCloseKey(key);
1701   } else {
1702     // Put generic cpu info to return
1703     strncpy(buf, "## __CPU__", buflen);
1704   }
1705 }
1706 
1707 void os::print_memory_info(outputStream* st) {
1708   st->print("Memory:");
1709   st->print(" %dk page", os::vm_page_size()>>10);
1710 
1711   // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
1712   // value if total memory is larger than 4GB
1713   MEMORYSTATUSEX ms;
1714   ms.dwLength = sizeof(ms);
1715   GlobalMemoryStatusEx(&ms);
1716 
1717   st->print(", physical %uk", os::physical_memory() >> 10);
1718   st->print("(%uk free)", os::available_memory() >> 10);





















1719 
1720   st->print(", swap %uk", ms.ullTotalPageFile >> 10);
1721   st->print("(%uk free)", ms.ullAvailPageFile >> 10);
1722   st->cr();
1723 }
1724 
1725 void os::print_siginfo(outputStream *st, const void* siginfo) {
1726   const EXCEPTION_RECORD* const er = (EXCEPTION_RECORD*)siginfo;
1727   st->print("siginfo:");
1728 
1729   char tmp[64];
1730   if (os::exception_name(er->ExceptionCode, tmp, sizeof(tmp)) == NULL) {
1731     strcpy(tmp, "EXCEPTION_??");
1732   }
1733   st->print(" %s (0x%x)", tmp, er->ExceptionCode);
1734 
1735   if ((er->ExceptionCode == EXCEPTION_ACCESS_VIOLATION ||
1736        er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR) &&
1737        er->NumberParameters >= 2) {
1738     switch (er->ExceptionInformation[0]) {
1739     case 0: st->print(", reading address"); break;
1740     case 1: st->print(", writing address"); break;
1741     case 8: st->print(", data execution prevention violation at address"); break;




1697     if (status != ERROR_SUCCESS) {
1698         strncpy(buf, "## __CPU__", buflen);
1699     }
1700     RegCloseKey(key);
1701   } else {
1702     // Put generic cpu info to return
1703     strncpy(buf, "## __CPU__", buflen);
1704   }
1705 }
1706 
1707 void os::print_memory_info(outputStream* st) {
1708   st->print("Memory:");
1709   st->print(" %dk page", os::vm_page_size()>>10);
1710 
1711   // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
1712   // value if total memory is larger than 4GB
1713   MEMORYSTATUSEX ms;
1714   ms.dwLength = sizeof(ms);
1715   GlobalMemoryStatusEx(&ms);
1716 
1717   st->print(", system-wide physical " INT64_FORMAT "M ", (int64_t) ms.ullTotalPhys >> 20);
1718   st->print("(" INT64_FORMAT "M free)\n", (int64_t) ms.ullAvailPhys >> 20);
1719 
1720   st->print("TotalPageFile size " INT64_FORMAT "M ", (int64_t) ms.ullTotalPageFile >> 20);
1721   st->print("(AvailPageFile size " INT64_FORMAT "M)", (int64_t) ms.ullAvailPageFile >> 20);
1722 
1723   // on 32bit Total/AvailVirtual are interesting (show us how close we get to 2-4 GB per process borders)
1724 #if defined(_M_IX86)
1725   st->print(", user-mode portion of virtual address-space " INT64_FORMAT "M ", (int64_t) ms.ullTotalVirtual >> 20);
1726   st->print("(" INT64_FORMAT "M free)", (int64_t) ms.ullAvailVirtual >> 20);
1727 #endif
1728 
1729   // extended memory statistics for a process
1730   PROCESS_MEMORY_COUNTERS_EX pmex;
1731   ZeroMemory(&pmex, sizeof(PROCESS_MEMORY_COUNTERS_EX));
1732   pmex.cb = sizeof(pmex);
1733   GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &pmex, sizeof(pmex));
1734 
1735   st->print("\ncurrent process WorkingSet (physical memory assigned to process): " INT64_FORMAT "M, ", (int64_t) pmex.WorkingSetSize >> 20);
1736   st->print("peak: " INT64_FORMAT "M\n", (int64_t) pmex.PeakWorkingSetSize >> 20);
1737 
1738   st->print("current process commit charge (\"private bytes\"): " INT64_FORMAT "M, ", (int64_t) pmex.PrivateUsage >> 20);
1739   st->print("peak: " INT64_FORMAT "M", (int64_t) pmex.PeakPagefileUsage >> 20);
1740 


1741   st->cr();
1742 }
1743 
1744 void os::print_siginfo(outputStream *st, const void* siginfo) {
1745   const EXCEPTION_RECORD* const er = (EXCEPTION_RECORD*)siginfo;
1746   st->print("siginfo:");
1747 
1748   char tmp[64];
1749   if (os::exception_name(er->ExceptionCode, tmp, sizeof(tmp)) == NULL) {
1750     strcpy(tmp, "EXCEPTION_??");
1751   }
1752   st->print(" %s (0x%x)", tmp, er->ExceptionCode);
1753 
1754   if ((er->ExceptionCode == EXCEPTION_ACCESS_VIOLATION ||
1755        er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR) &&
1756        er->NumberParameters >= 2) {
1757     switch (er->ExceptionInformation[0]) {
1758     case 0: st->print(", reading address"); break;
1759     case 1: st->print(", writing address"); break;
1760     case 8: st->print(", data execution prevention violation at address"); break;


< prev index next >