src/share/vm/runtime/fprofiler.cpp

Print this page




 144     if (counters == NULL) return NULL;
 145     return pc_for(index_for(pc));
 146   }
 147   static int bucket_count_for(address pc)  { return counters[index_for(pc)]; }
 148   static void init();
 149   static void record(address pc);
 150   static void print();
 151   static void print_blobs(CodeBlob* cb);
 152 };
 153 
 154 int*    PCRecorder::counters = NULL;
 155 address PCRecorder::base     = NULL;
 156 
 157 void PCRecorder::init() {
 158   MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 159   int s = size();
 160   counters = NEW_C_HEAP_ARRAY(int, s, mtInternal);
 161   for (int index = 0; index < s; index++) {
 162     counters[index] = 0;
 163   }
 164   base = CodeCache::first_address();
 165 }
 166 
 167 void PCRecorder::record(address pc) {
 168   if (counters == NULL) return;
 169   assert(CodeCache::contains(pc), "must be in CodeCache");
 170   counters[index_for(pc)]++;
 171 }
 172 
 173 
 174 address FlatProfiler::bucket_start_for(address pc) {
 175   return PCRecorder::bucket_start_for(pc);
 176 }
 177 
 178 int FlatProfiler::bucket_count_for(address pc) {
 179   return PCRecorder::bucket_count_for(pc);
 180 }
 181 
 182 void PCRecorder::print() {
 183   if (counters == NULL) return;
 184 




 144     if (counters == NULL) return NULL;
 145     return pc_for(index_for(pc));
 146   }
 147   static int bucket_count_for(address pc)  { return counters[index_for(pc)]; }
 148   static void init();
 149   static void record(address pc);
 150   static void print();
 151   static void print_blobs(CodeBlob* cb);
 152 };
 153 
 154 int*    PCRecorder::counters = NULL;
 155 address PCRecorder::base     = NULL;
 156 
 157 void PCRecorder::init() {
 158   MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 159   int s = size();
 160   counters = NEW_C_HEAP_ARRAY(int, s, mtInternal);
 161   for (int index = 0; index < s; index++) {
 162     counters[index] = 0;
 163   }
 164   base = CodeCache::low_bound();
 165 }
 166 
 167 void PCRecorder::record(address pc) {
 168   if (counters == NULL) return;
 169   assert(CodeCache::contains(pc), "must be in CodeCache");
 170   counters[index_for(pc)]++;
 171 }
 172 
 173 
 174 address FlatProfiler::bucket_start_for(address pc) {
 175   return PCRecorder::bucket_start_for(pc);
 176 }
 177 
 178 int FlatProfiler::bucket_count_for(address pc) {
 179   return PCRecorder::bucket_count_for(pc);
 180 }
 181 
 182 void PCRecorder::print() {
 183   if (counters == NULL) return;
 184