hotspot/src/os/windows/vm/os_windows.cpp
changeset 3577 488338f3a402
parent 2561 a62b5317b682
child 3809 a68ba546e735
equal deleted inserted replaced
3576:4ceec8fb3e18 3577:488338f3a402
   614 julong os::available_memory() {
   614 julong os::available_memory() {
   615   return win32::available_memory();
   615   return win32::available_memory();
   616 }
   616 }
   617 
   617 
   618 julong os::win32::available_memory() {
   618 julong os::win32::available_memory() {
   619   // FIXME: GlobalMemoryStatus() may return incorrect value if total memory
   619   // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
   620   // is larger than 4GB
   620   // value if total memory is larger than 4GB
   621   MEMORYSTATUS ms;
   621   MEMORYSTATUSEX ms;
   622   GlobalMemoryStatus(&ms);
   622   ms.dwLength = sizeof(ms);
   623 
   623   GlobalMemoryStatusEx(&ms);
   624   return (julong)ms.dwAvailPhys;
   624 
       
   625   return (julong)ms.ullAvailPhys;
   625 }
   626 }
   626 
   627 
   627 julong os::physical_memory() {
   628 julong os::physical_memory() {
   628   return win32::physical_memory();
   629   return win32::physical_memory();
   629 }
   630 }
  1577 
  1578 
  1578 void os::print_memory_info(outputStream* st) {
  1579 void os::print_memory_info(outputStream* st) {
  1579   st->print("Memory:");
  1580   st->print("Memory:");
  1580   st->print(" %dk page", os::vm_page_size()>>10);
  1581   st->print(" %dk page", os::vm_page_size()>>10);
  1581 
  1582 
  1582   // FIXME: GlobalMemoryStatus() may return incorrect value if total memory
  1583   // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
  1583   // is larger than 4GB
  1584   // value if total memory is larger than 4GB
  1584   MEMORYSTATUS ms;
  1585   MEMORYSTATUSEX ms;
  1585   GlobalMemoryStatus(&ms);
  1586   ms.dwLength = sizeof(ms);
       
  1587   GlobalMemoryStatusEx(&ms);
  1586 
  1588 
  1587   st->print(", physical %uk", os::physical_memory() >> 10);
  1589   st->print(", physical %uk", os::physical_memory() >> 10);
  1588   st->print("(%uk free)", os::available_memory() >> 10);
  1590   st->print("(%uk free)", os::available_memory() >> 10);
  1589 
  1591 
  1590   st->print(", swap %uk", ms.dwTotalPageFile >> 10);
  1592   st->print(", swap %uk", ms.ullTotalPageFile >> 10);
  1591   st->print("(%uk free)", ms.dwAvailPageFile >> 10);
  1593   st->print("(%uk free)", ms.ullAvailPageFile >> 10);
  1592   st->cr();
  1594   st->cr();
  1593 }
  1595 }
  1594 
  1596 
  1595 void os::print_siginfo(outputStream *st, void *siginfo) {
  1597 void os::print_siginfo(outputStream *st, void *siginfo) {
  1596   EXCEPTION_RECORD* er = (EXCEPTION_RECORD*)siginfo;
  1598   EXCEPTION_RECORD* er = (EXCEPTION_RECORD*)siginfo;
  3133   _vm_allocation_granularity = si.dwAllocationGranularity;
  3135   _vm_allocation_granularity = si.dwAllocationGranularity;
  3134   _processor_type  = si.dwProcessorType;
  3136   _processor_type  = si.dwProcessorType;
  3135   _processor_level = si.wProcessorLevel;
  3137   _processor_level = si.wProcessorLevel;
  3136   _processor_count = si.dwNumberOfProcessors;
  3138   _processor_count = si.dwNumberOfProcessors;
  3137 
  3139 
  3138   MEMORYSTATUS ms;
  3140   MEMORYSTATUSEX ms;
       
  3141   ms.dwLength = sizeof(ms);
       
  3142 
  3139   // also returns dwAvailPhys (free physical memory bytes), dwTotalVirtual, dwAvailVirtual,
  3143   // also returns dwAvailPhys (free physical memory bytes), dwTotalVirtual, dwAvailVirtual,
  3140   // dwMemoryLoad (% of memory in use)
  3144   // dwMemoryLoad (% of memory in use)
  3141   GlobalMemoryStatus(&ms);
  3145   GlobalMemoryStatusEx(&ms);
  3142   _physical_memory = ms.dwTotalPhys;
  3146   _physical_memory = ms.ullTotalPhys;
  3143 
  3147 
  3144   OSVERSIONINFO oi;
  3148   OSVERSIONINFO oi;
  3145   oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  3149   oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  3146   GetVersionEx(&oi);
  3150   GetVersionEx(&oi);
  3147   switch(oi.dwPlatformId) {
  3151   switch(oi.dwPlatformId) {