comparison src/share/vm/oops/instanceKlass.cpp @ 875:6a93908f268f

6857194: Add hotspot perf counters to aid class loading performance measurement Summary: Add new jvmstat counters to measure detailed class loading time Reviewed-by: acorn, kamg
author mchung
date Fri, 10 Jul 2009 11:10:00 -0700
parents d3676b4cb78c
children 1413494da700
comparison
equal deleted inserted replaced
812:85d0690f7d12 875:6a93908f268f
156 156
157 // Timing 157 // Timing
158 // timer handles recursion 158 // timer handles recursion
159 assert(THREAD->is_Java_thread(), "non-JavaThread in link_class_impl"); 159 assert(THREAD->is_Java_thread(), "non-JavaThread in link_class_impl");
160 JavaThread* jt = (JavaThread*)THREAD; 160 JavaThread* jt = (JavaThread*)THREAD;
161 PerfTraceTimedEvent vmtimer(ClassLoader::perf_class_link_time(),
162 ClassLoader::perf_classes_linked(),
163 jt->get_thread_stat()->class_link_recursion_count_addr());
164 161
165 // link super class before linking this class 162 // link super class before linking this class
166 instanceKlassHandle super(THREAD, this_oop->super()); 163 instanceKlassHandle super(THREAD, this_oop->super());
167 if (super.not_null()) { 164 if (super.not_null()) {
168 if (super->is_interface()) { // check if super class is an interface 165 if (super->is_interface()) { // check if super class is an interface
192 // in case the class is linked in the process of linking its superclasses 189 // in case the class is linked in the process of linking its superclasses
193 if (this_oop->is_linked()) { 190 if (this_oop->is_linked()) {
194 return true; 191 return true;
195 } 192 }
196 193
194 // trace only the link time for this klass that includes
195 // the verification time
196 PerfClassTraceTime vmtimer(ClassLoader::perf_class_link_time(),
197 ClassLoader::perf_class_link_selftime(),
198 ClassLoader::perf_classes_linked(),
199 jt->get_thread_stat()->perf_recursion_counts_addr(),
200 jt->get_thread_stat()->perf_timers_addr(),
201 PerfClassTraceTime::CLASS_LINK);
202
197 // verification & rewriting 203 // verification & rewriting
198 { 204 {
199 ObjectLocker ol(this_oop, THREAD); 205 ObjectLocker ol(this_oop, THREAD);
200 // rewritten will have been set if loader constraint error found 206 // rewritten will have been set if loader constraint error found
201 // on an earlier link attempt 207 // on an earlier link attempt
202 // don't verify or rewrite if already rewritten 208 // don't verify or rewrite if already rewritten
203 if (!this_oop->is_linked()) { 209 if (!this_oop->is_linked()) {
204 if (!this_oop->is_rewritten()) { 210 if (!this_oop->is_rewritten()) {
205 { 211 {
206 assert(THREAD->is_Java_thread(), "non-JavaThread in link_class_impl");
207 JavaThread* jt = (JavaThread*)THREAD;
208 // Timer includes any side effects of class verification (resolution, 212 // Timer includes any side effects of class verification (resolution,
209 // etc), but not recursive entry into verify_code(). 213 // etc), but not recursive entry into verify_code().
210 PerfTraceTime timer(ClassLoader::perf_class_verify_time(), 214 PerfClassTraceTime timer(ClassLoader::perf_class_verify_time(),
211 jt->get_thread_stat()->class_verify_recursion_count_addr()); 215 ClassLoader::perf_class_verify_selftime(),
216 ClassLoader::perf_classes_verified(),
217 jt->get_thread_stat()->perf_recursion_counts_addr(),
218 jt->get_thread_stat()->perf_timers_addr(),
219 PerfClassTraceTime::CLASS_VERIFY);
212 bool verify_ok = verify_code(this_oop, throw_verifyerror, THREAD); 220 bool verify_ok = verify_code(this_oop, throw_verifyerror, THREAD);
213 if (!verify_ok) { 221 if (!verify_ok) {
214 return false; 222 return false;
215 } 223 }
216 } 224 }
348 { 356 {
349 assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl"); 357 assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl");
350 JavaThread* jt = (JavaThread*)THREAD; 358 JavaThread* jt = (JavaThread*)THREAD;
351 // Timer includes any side effects of class initialization (resolution, 359 // Timer includes any side effects of class initialization (resolution,
352 // etc), but not recursive entry into call_class_initializer(). 360 // etc), but not recursive entry into call_class_initializer().
353 PerfTraceTimedEvent timer(ClassLoader::perf_class_init_time(), 361 PerfClassTraceTime timer(ClassLoader::perf_class_init_time(),
354 ClassLoader::perf_classes_inited(), 362 ClassLoader::perf_class_init_selftime(),
355 jt->get_thread_stat()->class_init_recursion_count_addr()); 363 ClassLoader::perf_classes_inited(),
364 jt->get_thread_stat()->perf_recursion_counts_addr(),
365 jt->get_thread_stat()->perf_timers_addr(),
366 PerfClassTraceTime::CLASS_CLINIT);
356 this_oop->call_class_initializer(THREAD); 367 this_oop->call_class_initializer(THREAD);
357 } 368 }
358 369
359 // Step 9 370 // Step 9
360 if (!HAS_PENDING_EXCEPTION) { 371 if (!HAS_PENDING_EXCEPTION) {