< prev index next >

src/hotspot/share/services/mallocSiteTable.hpp

Print this page




  25 #ifndef SHARE_VM_SERVICES_MALLOC_SITE_TABLE_HPP
  26 #define SHARE_VM_SERVICES_MALLOC_SITE_TABLE_HPP
  27 
  28 #if INCLUDE_NMT
  29 
  30 #include "memory/allocation.hpp"
  31 #include "runtime/atomic.hpp"
  32 #include "services/allocationSite.hpp"
  33 #include "services/mallocTracker.hpp"
  34 #include "services/nmtCommon.hpp"
  35 #include "utilities/nativeCallStack.hpp"
  36 
  37 // MallocSite represents a code path that eventually calls
  38 // os::malloc() to allocate memory
  39 class MallocSite : public AllocationSite<MemoryCounter> {
  40  private:
  41   MEMFLAGS _flags;
  42 
  43  public:
  44   MallocSite() :
  45     AllocationSite<MemoryCounter>(NativeCallStack::EMPTY_STACK), _flags(mtNone) {}
  46 
  47   MallocSite(const NativeCallStack& stack, MEMFLAGS flags) :
  48     AllocationSite<MemoryCounter>(stack), _flags(flags) {}
  49 
  50 
  51   void allocate(size_t size)      { data()->allocate(size);   }
  52   void deallocate(size_t size)    { data()->deallocate(size); }
  53 
  54   // Memory allocated from this code path
  55   size_t size()  const { return peek()->size(); }
  56   // The number of calls were made
  57   size_t count() const { return peek()->count(); }
  58   MEMFLAGS flags() const  { return (MEMFLAGS)_flags; }
  59 };
  60 
  61 // Malloc site hashtable entry
  62 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> {
  63  private:
  64   MallocSite                         _malloc_site;
  65   MallocSiteHashtableEntry* volatile _next;




  25 #ifndef SHARE_VM_SERVICES_MALLOC_SITE_TABLE_HPP
  26 #define SHARE_VM_SERVICES_MALLOC_SITE_TABLE_HPP
  27 
  28 #if INCLUDE_NMT
  29 
  30 #include "memory/allocation.hpp"
  31 #include "runtime/atomic.hpp"
  32 #include "services/allocationSite.hpp"
  33 #include "services/mallocTracker.hpp"
  34 #include "services/nmtCommon.hpp"
  35 #include "utilities/nativeCallStack.hpp"
  36 
  37 // MallocSite represents a code path that eventually calls
  38 // os::malloc() to allocate memory
  39 class MallocSite : public AllocationSite<MemoryCounter> {
  40  private:
  41   MEMFLAGS _flags;
  42 
  43  public:
  44   MallocSite() :
  45     AllocationSite<MemoryCounter>(NativeCallStack::empty_stack()), _flags(mtNone) {}
  46 
  47   MallocSite(const NativeCallStack& stack, MEMFLAGS flags) :
  48     AllocationSite<MemoryCounter>(stack), _flags(flags) {}
  49 
  50 
  51   void allocate(size_t size)      { data()->allocate(size);   }
  52   void deallocate(size_t size)    { data()->deallocate(size); }
  53 
  54   // Memory allocated from this code path
  55   size_t size()  const { return peek()->size(); }
  56   // The number of calls were made
  57   size_t count() const { return peek()->count(); }
  58   MEMFLAGS flags() const  { return (MEMFLAGS)_flags; }
  59 };
  60 
  61 // Malloc site hashtable entry
  62 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> {
  63  private:
  64   MallocSite                         _malloc_site;
  65   MallocSiteHashtableEntry* volatile _next;


< prev index next >