< prev index next >

src/hotspot/share/code/codeCache.hpp


316   static int get_codemem_full_count(int code_blob_type) {                                                                            
317     CodeHeap* heap = get_code_heap(code_blob_type);                                                                                  
318     return (heap != NULL) ? heap->full_count() : 0;                                                                                  
319   }                                                                                                                                  
320 
321   // CodeHeap State Analytics.                                                                                                       
322   // interface methods for CodeHeap printing, called by CompileBroker                                                                
323   static void aggregate(outputStream *out, const char* granularity);                                                                 
324   static void discard(outputStream *out);                                                                                            
325   static void print_usedSpace(outputStream *out);                                                                                    
326   static void print_freeSpace(outputStream *out);                                                                                    
327   static void print_count(outputStream *out);                                                                                        
328   static void print_space(outputStream *out);                                                                                        
329   static void print_age(outputStream *out);                                                                                          
330   static void print_names(outputStream *out);                                                                                        
331 };                                                                                                                                   
332 
333 
334 // Iterator to iterate over nmethods in the CodeCache.                                                                               
335 template <class T, class Filter> class CodeBlobIterator : public StackObj {                                                          
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
336  private:                                                                                                                            
337   CodeBlob* _code_blob;   // Current CodeBlob                                                                                        
338   GrowableArrayIterator<CodeHeap*> _heap;                                                                                            
339   GrowableArrayIterator<CodeHeap*> _end;                                                                                             
340   bool _only_alive;                                                                                                                  
341   bool _only_not_unloading;                                                                                                          
342 
343  public:                                                                                                                             
344   CodeBlobIterator(bool only_alive, bool only_not_unloading, T* nm = NULL)                                                           
345     : _only_alive(only_alive),                                                                                                       
346       _only_not_unloading(only_not_unloading)                                                                                        
347   {                                                                                                                                  
348     if (Filter::heaps() == NULL) {                                                                                                   
349       return;                                                                                                                        
350     }                                                                                                                                
351     _heap = Filter::heaps()->begin();                                                                                                
352     _end = Filter::heaps()->end();                                                                                                   
353     // If set to NULL, initialized by first call to next()                                                                           
354     _code_blob = (CodeBlob*)nm;                                                                                                      
355     if (nm != NULL) {                                                                                                                
356       while(!(*_heap)->contains_blob(_code_blob)) {                                                                                  
357         ++_heap;                                                                                                                     
358       }                                                                                                                              
359       assert((*_heap)->contains_blob(_code_blob), "match not found");                                                                
360     }                                                                                                                                
361   }                                                                                                                                  
362 
363   CodeBlobIterator(const CodeBlobIterator& other)                                                                                    
364     : _code_blob(other._code_blob),                                                                                                  
365       _heap(other._heap),                                                                                                            

316   static int get_codemem_full_count(int code_blob_type) {
317     CodeHeap* heap = get_code_heap(code_blob_type);
318     return (heap != NULL) ? heap->full_count() : 0;
319   }
320 
321   // CodeHeap State Analytics.
322   // interface methods for CodeHeap printing, called by CompileBroker
323   static void aggregate(outputStream *out, const char* granularity);
324   static void discard(outputStream *out);
325   static void print_usedSpace(outputStream *out);
326   static void print_freeSpace(outputStream *out);
327   static void print_count(outputStream *out);
328   static void print_space(outputStream *out);
329   static void print_age(outputStream *out);
330   static void print_names(outputStream *out);
331 };
332 
333 
334 // Iterator to iterate over nmethods in the CodeCache.
335 template <class T, class Filter> class CodeBlobIterator : public StackObj {
336  public:
337   enum LivenessFilter { all_blobs, only_alive, only_alive_and_not_unloading };
338 
339  private:
340   CodeBlob* _code_blob;   // Current CodeBlob
341   GrowableArrayIterator<CodeHeap*> _heap;
342   GrowableArrayIterator<CodeHeap*> _end;
343   bool _only_alive;
344   bool _only_not_unloading;
345 
346  public:
347   CodeBlobIterator(LivenessFilter filter, T* nm = NULL)
348     : _only_alive(filter == only_alive || filter == only_alive_and_not_unloading),
349       _only_not_unloading(filter == only_alive_and_not_unloading)
350   {
351     if (Filter::heaps() == NULL) {
352       return;
353     }
354     _heap = Filter::heaps()->begin();
355     _end = Filter::heaps()->end();
356     // If set to NULL, initialized by first call to next()
357     _code_blob = (CodeBlob*)nm;
358     if (nm != NULL) {
359       while(!(*_heap)->contains_blob(_code_blob)) {
360         ++_heap;
361       }
362       assert((*_heap)->contains_blob(_code_blob), "match not found");
363     }
364   }
365 
366   CodeBlobIterator(const CodeBlobIterator& other)
367     : _code_blob(other._code_blob),
368       _heap(other._heap),
< prev index next >