src/hotspot/share/services/virtualMemoryTracker.hpp
changeset 49349 7194eb9e8f19
parent 49193 c3ec048aad63
child 49364 601146c66cad
equal deleted inserted replaced
49348:fde3feaaa4ed 49349:7194eb9e8f19
   158   static inline void move_committed_memory(MEMFLAGS from, MEMFLAGS to, size_t size) {
   158   static inline void move_committed_memory(MEMFLAGS from, MEMFLAGS to, size_t size) {
   159     as_snapshot()->by_type(from)->uncommit_memory(size);
   159     as_snapshot()->by_type(from)->uncommit_memory(size);
   160     as_snapshot()->by_type(to)->commit_memory(size);
   160     as_snapshot()->by_type(to)->commit_memory(size);
   161   }
   161   }
   162 
   162 
   163   static void snapshot(VirtualMemorySnapshot* s);
   163   static inline void snapshot(VirtualMemorySnapshot* s) {
       
   164     as_snapshot()->copy_to(s);
       
   165   }
   164 
   166 
   165   static VirtualMemorySnapshot* as_snapshot() {
   167   static VirtualMemorySnapshot* as_snapshot() {
   166     return (VirtualMemorySnapshot*)_snapshot;
   168     return (VirtualMemorySnapshot*)_snapshot;
   167   }
   169   }
   168 
   170 
   332 
   334 
   333   inline bool equals(const ReservedMemoryRegion& rgn) const {
   335   inline bool equals(const ReservedMemoryRegion& rgn) const {
   334     return compare(rgn) == 0;
   336     return compare(rgn) == 0;
   335   }
   337   }
   336 
   338 
   337   // uncommitted thread stack bottom, above guard pages if there is any.
       
   338   address thread_stack_uncommitted_bottom() const;
       
   339 
       
   340   bool    add_committed_region(address addr, size_t size, const NativeCallStack& stack);
   339   bool    add_committed_region(address addr, size_t size, const NativeCallStack& stack);
   341   bool    remove_uncommitted_region(address addr, size_t size);
   340   bool    remove_uncommitted_region(address addr, size_t size);
   342 
   341 
   343   size_t  committed_size() const;
   342   size_t  committed_size() const;
   344 
   343 
   388 };
   387 };
   389 
   388 
   390 // Main class called from MemTracker to track virtual memory allocations, commits and releases.
   389 // Main class called from MemTracker to track virtual memory allocations, commits and releases.
   391 class VirtualMemoryTracker : AllStatic {
   390 class VirtualMemoryTracker : AllStatic {
   392   friend class VirtualMemoryTrackerTest;
   391   friend class VirtualMemoryTrackerTest;
   393   friend class ThreadStackTrackingTest;
       
   394 
   392 
   395  public:
   393  public:
   396   static bool initialize(NMT_TrackingLevel level);
   394   static bool initialize(NMT_TrackingLevel level);
   397 
   395 
   398   // Late phase initialization
   396   // Late phase initialization
   407 
   405 
   408   // Walk virtual memory data structure for creating baseline, etc.
   406   // Walk virtual memory data structure for creating baseline, etc.
   409   static bool walk_virtual_memory(VirtualMemoryWalker* walker);
   407   static bool walk_virtual_memory(VirtualMemoryWalker* walker);
   410 
   408 
   411   static bool transition(NMT_TrackingLevel from, NMT_TrackingLevel to);
   409   static bool transition(NMT_TrackingLevel from, NMT_TrackingLevel to);
   412 
       
   413   // Snapshot current thread stacks
       
   414   static void snapshot_thread_stacks();
       
   415 
   410 
   416  private:
   411  private:
   417   static SortedLinkedList<ReservedMemoryRegion, compare_reserved_region_base>* _reserved_regions;
   412   static SortedLinkedList<ReservedMemoryRegion, compare_reserved_region_base>* _reserved_regions;
   418 };
   413 };
   419 
   414