src/hotspot/share/services/virtualMemoryTracker.hpp
branchstuefe-new-metaspace-branch
changeset 59272 54750b448264
parent 58063 bdf136b8ae0e
equal deleted inserted replaced
59271:1558266946de 59272:54750b448264
    26 #define SHARE_SERVICES_VIRTUALMEMORYTRACKER_HPP
    26 #define SHARE_SERVICES_VIRTUALMEMORYTRACKER_HPP
    27 
    27 
    28 #if INCLUDE_NMT
    28 #if INCLUDE_NMT
    29 
    29 
    30 #include "memory/allocation.hpp"
    30 #include "memory/allocation.hpp"
    31 #include "memory/metaspace/metaspaceEnums.hpp"
    31 #include "memory/metaspace.hpp"
    32 #include "services/allocationSite.hpp"
    32 #include "services/allocationSite.hpp"
    33 #include "services/nmtCommon.hpp"
    33 #include "services/nmtCommon.hpp"
    34 #include "utilities/linkedlist.hpp"
    34 #include "utilities/linkedlist.hpp"
    35 #include "utilities/nativeCallStack.hpp"
    35 #include "utilities/nativeCallStack.hpp"
    36 #include "utilities/ostream.hpp"
    36 #include "utilities/ostream.hpp"
   418 };
   418 };
   419 
   419 
   420 
   420 
   421 class MetaspaceSnapshot : public ResourceObj {
   421 class MetaspaceSnapshot : public ResourceObj {
   422 private:
   422 private:
   423   size_t  _reserved_in_bytes[metaspace::MetadataTypeCount];
   423   size_t  _reserved_in_bytes[Metaspace::MetadataTypeCount];
   424   size_t  _committed_in_bytes[metaspace::MetadataTypeCount];
   424   size_t  _committed_in_bytes[Metaspace::MetadataTypeCount];
   425   size_t  _used_in_bytes[metaspace::MetadataTypeCount];
   425   size_t  _used_in_bytes[Metaspace::MetadataTypeCount];
   426   size_t  _free_in_bytes[metaspace::MetadataTypeCount];
   426   size_t  _free_in_bytes[Metaspace::MetadataTypeCount];
   427 
   427 
   428 public:
   428 public:
   429   MetaspaceSnapshot();
   429   MetaspaceSnapshot();
   430   size_t reserved_in_bytes(metaspace::MetadataType type)   const { assert_valid_metadata_type(type); return _reserved_in_bytes[type]; }
   430   size_t reserved_in_bytes(Metaspace::MetadataType type)   const { assert_valid_metadata_type(type); return _reserved_in_bytes[type]; }
   431   size_t committed_in_bytes(metaspace::MetadataType type)  const { assert_valid_metadata_type(type); return _committed_in_bytes[type]; }
   431   size_t committed_in_bytes(Metaspace::MetadataType type)  const { assert_valid_metadata_type(type); return _committed_in_bytes[type]; }
   432   size_t used_in_bytes(metaspace::MetadataType type)       const { assert_valid_metadata_type(type); return _used_in_bytes[type]; }
   432   size_t used_in_bytes(Metaspace::MetadataType type)       const { assert_valid_metadata_type(type); return _used_in_bytes[type]; }
   433   size_t free_in_bytes(metaspace::MetadataType type)       const { assert_valid_metadata_type(type); return _free_in_bytes[type]; }
   433   size_t free_in_bytes(Metaspace::MetadataType type)       const { assert_valid_metadata_type(type); return _free_in_bytes[type]; }
   434 
   434 
   435   static void snapshot(MetaspaceSnapshot& s);
   435   static void snapshot(MetaspaceSnapshot& s);
   436 
   436 
   437 private:
   437 private:
   438   static void snapshot(metaspace::MetadataType type, MetaspaceSnapshot& s);
   438   static void snapshot(Metaspace::MetadataType type, MetaspaceSnapshot& s);
   439 
   439 
   440   static void assert_valid_metadata_type(metaspace::MetadataType type) {
   440   static void assert_valid_metadata_type(Metaspace::MetadataType type) {
   441     assert(type == metaspace::ClassType || type == metaspace::NonClassType,
   441     assert(type == Metaspace::ClassType || type == Metaspace::NonClassType,
   442       "Invalid metadata type");
   442       "Invalid metadata type");
   443   }
   443   }
   444 };
   444 };
   445 
   445 
   446 #endif // INCLUDE_NMT
   446 #endif // INCLUDE_NMT