< prev index next >

src/hotspot/os/windows/os_windows.cpp

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

@@ -1712,15 +1712,34 @@
   // value if total memory is larger than 4GB
   MEMORYSTATUSEX ms;
   ms.dwLength = sizeof(ms);
   GlobalMemoryStatusEx(&ms);
 
-  st->print(", physical %uk", os::physical_memory() >> 10);
-  st->print("(%uk free)", os::available_memory() >> 10);
+  st->print(", system-wide physical " INT64_FORMAT "k [" INT64_FORMAT "M] ", (int64_t) ms.ullTotalPhys >> 10, (int64_t) ms.ullTotalPhys >> 20);
+  st->print("(" INT64_FORMAT "k [" INT64_FORMAT "M] free)", (int64_t) ms.ullAvailPhys >> 10,  (int64_t) ms.ullAvailPhys >> 20);
+
+  st->print(", TotalPageFile size " INT64_FORMAT "k [" INT64_FORMAT "M] ", (int64_t) ms.ullTotalPageFile >> 10, (int64_t) ms.ullTotalPageFile >> 20);
+  st->print("(AvailPageFile size " INT64_FORMAT "k [" INT64_FORMAT "M])", (int64_t) ms.ullAvailPageFile >> 10, (int64_t) ms.ullAvailPageFile >> 20);
+
+  // on 32bit Total/AvailVirtual are interesting (show us how close we get to 2-4 GB per process borders)
+#if defined(_M_IX86)
+  st->print(", user-mode portion of virtual address-space " INT64_FORMAT "k [" INT64_FORMAT "M] ", (int64_t) ms.ullTotalVirtual >> 10, (int64_t) ms.ullTotalVirtual >> 20);
+  st->print("(" INT64_FORMAT "k [" INT64_FORMAT "M] free)", (int64_t) ms.ullAvailVirtual >> 10, (int64_t) ms.ullAvailVirtual >> 20);
+#endif
+
+  // extended memory statistics for a process
+  PROCESS_MEMORY_COUNTERS_EX pmex;
+  ZeroMemory(&pmex, sizeof(PROCESS_MEMORY_COUNTERS_EX));
+  pmex.cb = sizeof(pmex);
+  GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &pmex, sizeof(pmex));
+
+  st->print("\ncurrent process WorkingSet (physical memory assigned to process): " INT64_FORMAT "k [" INT64_FORMAT "M], ", (int64_t) pmex.WorkingSetSize >> 10, (int64_t) pmex.WorkingSetSize >> 20);
+  st->print("peak: " INT64_FORMAT "k [" INT64_FORMAT "M]\n", (int64_t) pmex.PeakWorkingSetSize >> 10, (int64_t) pmex.PeakWorkingSetSize >> 20);
+
+  st->print("\ncurrent process commit charge (\"private bytes\"): " INT64_FORMAT "k [" INT64_FORMAT "M], ", (int64_t) pmex.PrivateUsage >> 10, (int64_t) pmex.PrivateUsage >> 20);
+  st->print("peak: " INT64_FORMAT "k [" INT64_FORMAT "M] \n", (int64_t) pmex.PeakPagefileUsage >> 10, (int64_t) pmex.PeakPagefileUsage >> 20);
 
-  st->print(", swap %uk", ms.ullTotalPageFile >> 10);
-  st->print("(%uk free)", ms.ullAvailPageFile >> 10);
   st->cr();
 }
 
 void os::print_siginfo(outputStream *st, const void* siginfo) {
   const EXCEPTION_RECORD* const er = (EXCEPTION_RECORD*)siginfo;
< prev index next >