src/share/vm/services/memRecorder.hpp

Print this page
rev 3953 : JDK-8005012: Add WB APIs to better support NMT testing
Summary:


 196 };
 197 
 198 
 199 
 200 #define DEFAULT_RECORDER_PTR_ARRAY_SIZE 512
 201 
 202 class MemRecorder : public CHeapObj<mtNMT|otNMTRecorder> {
 203   friend class MemSnapshot;
 204   friend class MemTracker;
 205   friend class MemTrackWorker;
 206   friend class GenerationData;
 207 
 208  protected:
 209   // the array that holds memory records
 210   MemPointerArray*         _pointer_records;
 211 
 212  private:
 213   // used for linked list
 214   MemRecorder*             _next;
 215   // active recorder can only record a certain generation data
 216   debug_only(unsigned long _generation;)
 217 
 218  protected:
 219   _NOINLINE_ MemRecorder();
 220   ~MemRecorder();
 221 
 222   // record a memory operation
 223   bool record(address addr, MEMFLAGS flags, size_t size, address caller_pc = 0);
 224 
 225   // linked list support
 226   inline void set_next(MemRecorder* rec) {
 227     _next = rec;
 228   }
 229 
 230   inline MemRecorder* next() const {
 231     return _next;
 232   }
 233 
 234   // if the recorder is full
 235   inline bool is_full() const {
 236     assert(_pointer_records != NULL, "just check");
 237     return _pointer_records->is_full();
 238   }
 239 
 240   // if running out of memory when initializing recorder's internal
 241   // data
 242   inline bool out_of_memory() const {
 243     return (_pointer_records == NULL ||
 244       _pointer_records->out_of_memory());
 245   }
 246 
 247   inline void clear() {
 248     assert(_pointer_records != NULL, "Just check");
 249     _pointer_records->clear();
 250   }
 251 
 252   SequencedRecordIterator pointer_itr();
 253 


 254  protected:
 255   // number of MemRecorder instance
 256   static volatile jint _instance_count;
 257 
 258  private:
 259   // sorting function, sort records into following order
 260   // 1. memory address
 261   // 2. allocation type
 262   // 3. sequence number
 263   static int sort_record_fn(const void* e1, const void* e2);
 264 
 265   debug_only(void check_dup_seq(jint seq) const;)
 266   debug_only(void set_generation();)
 267 };
 268 
 269 #endif // SHARE_VM_SERVICES_MEM_RECORDER_HPP


 196 };
 197 
 198 
 199 
 200 #define DEFAULT_RECORDER_PTR_ARRAY_SIZE 512
 201 
 202 class MemRecorder : public CHeapObj<mtNMT|otNMTRecorder> {
 203   friend class MemSnapshot;
 204   friend class MemTracker;
 205   friend class MemTrackWorker;
 206   friend class GenerationData;
 207 
 208  protected:
 209   // the array that holds memory records
 210   MemPointerArray*         _pointer_records;
 211 
 212  private:
 213   // used for linked list
 214   MemRecorder*             _next;
 215   // active recorder can only record a certain generation data
 216   unsigned long            _generation;
 217 
 218  protected:
 219   _NOINLINE_ MemRecorder();
 220   ~MemRecorder();
 221 
 222   // record a memory operation
 223   bool record(address addr, MEMFLAGS flags, size_t size, address caller_pc = 0);
 224 
 225   // linked list support
 226   inline void set_next(MemRecorder* rec) {
 227     _next = rec;
 228   }
 229 
 230   inline MemRecorder* next() const {
 231     return _next;
 232   }
 233 
 234   // if the recorder is full
 235   inline bool is_full() const {
 236     assert(_pointer_records != NULL, "just check");
 237     return _pointer_records->is_full();
 238   }
 239 
 240   // if running out of memory when initializing recorder's internal
 241   // data
 242   inline bool out_of_memory() const {
 243     return (_pointer_records == NULL ||
 244       _pointer_records->out_of_memory());
 245   }
 246 
 247   inline void clear() {
 248     assert(_pointer_records != NULL, "Just check");
 249     _pointer_records->clear();
 250   }
 251 
 252   SequencedRecordIterator pointer_itr();
 253 
 254   // return the generation of this recorder which it belongs to
 255   unsigned long get_generation() const { return _generation; }
 256  protected:
 257   // number of MemRecorder instance
 258   static volatile jint _instance_count;
 259 
 260  private:
 261   // sorting function, sort records into following order
 262   // 1. memory address
 263   // 2. allocation type
 264   // 3. sequence number
 265   static int sort_record_fn(const void* e1, const void* e2);
 266 
 267   debug_only(void check_dup_seq(jint seq) const;)
 268   void set_generation();
 269 };
 270 
 271 #endif // SHARE_VM_SERVICES_MEM_RECORDER_HPP