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