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