src/hotspot/share/gc/g1/g1NUMA.hpp
changeset 59062 6530de931b8e
parent 59060 fce1fa1bdc91
equal deleted inserted replaced
59061:df6f2350edfa 59062:6530de931b8e
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_VM_GC_G1_NUMA_HPP
    25 #ifndef SHARE_VM_GC_G1_NUMA_HPP
    26 #define SHARE_VM_GC_G1_NUMA_HPP
    26 #define SHARE_VM_GC_G1_NUMA_HPP
    27 
    27 
       
    28 #include "gc/g1/g1NUMAStats.hpp"
       
    29 #include "gc/g1/heapRegion.hpp"
    28 #include "memory/allocation.hpp"
    30 #include "memory/allocation.hpp"
    29 #include "runtime/os.hpp"
    31 #include "runtime/os.hpp"
    30 
    32 
    31 class HeapRegion;
    33 class LogStream;
    32 
    34 
    33 class G1NUMA: public CHeapObj<mtGC> {
    35 class G1NUMA: public CHeapObj<mtGC> {
    34   // Mapping of available node ids to  0-based index which can be used for
    36   // Mapping of available node ids to  0-based index which can be used for
    35   // fast resource management. I.e. for every node id provides a unique value in
    37   // fast resource management. I.e. for every node id provides a unique value in
    36   // the range from [0, {# of nodes-1}].
    38   // the range from [0, {# of nodes-1}].
    46 
    48 
    47   // HeapRegion size
    49   // HeapRegion size
    48   size_t _region_size;
    50   size_t _region_size;
    49   // Necessary when touching memory.
    51   // Necessary when touching memory.
    50   size_t _page_size;
    52   size_t _page_size;
       
    53 
       
    54   // Stores statistic data.
       
    55   G1NUMAStats* _stats;
    51 
    56 
    52   size_t region_size() const;
    57   size_t region_size() const;
    53   size_t page_size() const;
    58   size_t page_size() const;
    54 
    59 
    55   // Returns node index of the given node id.
    60   // Returns node index of the given node id.
   111   void request_memory_on_node(void* aligned_address, size_t size_in_bytes, uint region_index);
   116   void request_memory_on_node(void* aligned_address, size_t size_in_bytes, uint region_index);
   112 
   117 
   113   // Returns maximum search depth which is used to limit heap region search iterations.
   118   // Returns maximum search depth which is used to limit heap region search iterations.
   114   // The number of active nodes, page size and heap region size are considered.
   119   // The number of active nodes, page size and heap region size are considered.
   115   uint max_search_depth() const;
   120   uint max_search_depth() const;
       
   121 
       
   122   // Update the given phase of requested and allocated node index.
       
   123   void update_statistics(G1NUMAStats::NodeDataItems phase, uint requested_node_index, uint allocated_node_index);
       
   124 
       
   125   // Copy all allocated statistics of the given phase and requested node.
       
   126   // Precondition: allocated_stat should have same length of active nodes.
       
   127   void copy_statistics(G1NUMAStats::NodeDataItems phase, uint requested_node_index, size_t* allocated_stat);
       
   128 
       
   129   // Print all statistics.
       
   130   void print_statistics() const;
       
   131 };
       
   132 
       
   133 class G1NodeIndexCheckClosure : public HeapRegionClosure {
       
   134   const char* _desc;
       
   135   G1NUMA* _numa;
       
   136   // Records matched count of each node.
       
   137   uint* _matched;
       
   138   // Records mismatched count of each node.
       
   139   uint* _mismatched;
       
   140   // Records total count of each node.
       
   141   // Total = matched + mismatched + unknown.
       
   142   uint* _total;
       
   143   LogStream* _ls;
       
   144 
       
   145 public:
       
   146   G1NodeIndexCheckClosure(const char* desc, G1NUMA* numa, LogStream* ls);
       
   147   ~G1NodeIndexCheckClosure();
       
   148 
       
   149   bool do_heap_region(HeapRegion* hr);
   116 };
   150 };
   117 
   151 
   118 #endif // SHARE_VM_GC_G1_NUMA_HPP
   152 #endif // SHARE_VM_GC_G1_NUMA_HPP