src/os/windows/vm/os_windows.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, 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  *
  23  */
  24 
  25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
  26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP
  27 // Win32_OS defines the interface to windows operating systems
  28 
  29 class win32 {
  30   friend class os;
  31 
  32  protected:
  33   static int    _vm_page_size;
  34   static int    _vm_allocation_granularity;
  35   static int    _processor_type;
  36   static int    _processor_level;
  37   static julong _physical_memory;
  38   static size_t _default_stack_size;
  39   static bool   _is_nt;
  40   static bool   _is_windows_2003;
  41   static bool   _is_windows_server;

  42 
  43   static void print_windows_version(outputStream* st);
  44 
  45  public:
  46   // Windows-specific interface:
  47   static void   initialize_system_info();
  48   static void   setmode_streams();
  49 
  50   // Processor info as provided by NT
  51   static int processor_type()  { return _processor_type;  }
  52   // Processor level may not be accurate on non-NT systems
  53   static int processor_level() {
  54     assert(is_nt(), "use vm_version instead");
  55     return _processor_level;
  56   }
  57   static julong available_memory();
  58   static julong physical_memory() { return _physical_memory; }
  59 
  60   // load dll from Windows system directory or Windows directory
  61   static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen);
  62 



  63  public:
  64   // Generic interface:
  65 
  66   // Trace number of created threads
  67   static          intx  _os_thread_limit;
  68   static volatile intx  _os_thread_count;
  69 
  70   // Tells whether the platform is NT or Windown95
  71   static bool is_nt() { return _is_nt; }
  72 
  73   // Tells whether this is a server version of Windows
  74   static bool is_windows_server() { return _is_windows_server; }
  75 
  76   // Tells whether the platform is Windows 2003
  77   static bool is_windows_2003() { return _is_windows_2003; }
  78 
  79   // Returns the byte size of a virtual memory page
  80   static int vm_page_size() { return _vm_page_size; }
  81 
  82   // Returns the size in bytes of memory blocks which can be allocated.


   1 /*
   2  * Copyright (c) 1997, 2014, 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  *
  23  */
  24 
  25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
  26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP
  27 // Win32_OS defines the interface to windows operating systems
  28 
  29 class win32 {
  30   friend class os;
  31 
  32  protected:
  33   static int    _vm_page_size;
  34   static int    _vm_allocation_granularity;
  35   static int    _processor_type;
  36   static int    _processor_level;
  37   static julong _physical_memory;
  38   static size_t _default_stack_size;
  39   static bool   _is_nt;
  40   static bool   _is_windows_2003;
  41   static bool   _is_windows_server;
  42   static bool   _has_performance_count;
  43 
  44   static void print_windows_version(outputStream* st);
  45 
  46  public:
  47   // Windows-specific interface:
  48   static void   initialize_system_info();
  49   static void   setmode_streams();
  50 
  51   // Processor info as provided by NT
  52   static int processor_type()  { return _processor_type;  }
  53   // Processor level may not be accurate on non-NT systems
  54   static int processor_level() {
  55     assert(is_nt(), "use vm_version instead");
  56     return _processor_level;
  57   }
  58   static julong available_memory();
  59   static julong physical_memory() { return _physical_memory; }
  60 
  61   // load dll from Windows system directory or Windows directory
  62   static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen);
  63   
  64   private:
  65     static void initialize_performance_counter();
  66 
  67  public:
  68   // Generic interface:
  69 
  70   // Trace number of created threads
  71   static          intx  _os_thread_limit;
  72   static volatile intx  _os_thread_count;
  73 
  74   // Tells whether the platform is NT or Windown95
  75   static bool is_nt() { return _is_nt; }
  76 
  77   // Tells whether this is a server version of Windows
  78   static bool is_windows_server() { return _is_windows_server; }
  79 
  80   // Tells whether the platform is Windows 2003
  81   static bool is_windows_2003() { return _is_windows_2003; }
  82 
  83   // Returns the byte size of a virtual memory page
  84   static int vm_page_size() { return _vm_page_size; }
  85 
  86   // Returns the size in bytes of memory blocks which can be allocated.