Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classLoader.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 | 3ec1ff9307d6 |
children | 66b0f834a440 |
comparison
equal
deleted
inserted
replaced
812:85d0690f7d12 | 875:6a93908f268f |
---|---|
46 // Globals | 46 // Globals |
47 | 47 |
48 PerfCounter* ClassLoader::_perf_accumulated_time = NULL; | 48 PerfCounter* ClassLoader::_perf_accumulated_time = NULL; |
49 PerfCounter* ClassLoader::_perf_classes_inited = NULL; | 49 PerfCounter* ClassLoader::_perf_classes_inited = NULL; |
50 PerfCounter* ClassLoader::_perf_class_init_time = NULL; | 50 PerfCounter* ClassLoader::_perf_class_init_time = NULL; |
51 PerfCounter* ClassLoader::_perf_class_init_selftime = NULL; | |
52 PerfCounter* ClassLoader::_perf_classes_verified = NULL; | |
51 PerfCounter* ClassLoader::_perf_class_verify_time = NULL; | 53 PerfCounter* ClassLoader::_perf_class_verify_time = NULL; |
54 PerfCounter* ClassLoader::_perf_class_verify_selftime = NULL; | |
52 PerfCounter* ClassLoader::_perf_classes_linked = NULL; | 55 PerfCounter* ClassLoader::_perf_classes_linked = NULL; |
53 PerfCounter* ClassLoader::_perf_class_link_time = NULL; | 56 PerfCounter* ClassLoader::_perf_class_link_time = NULL; |
57 PerfCounter* ClassLoader::_perf_class_link_selftime = NULL; | |
58 PerfCounter* ClassLoader::_perf_class_parse_time = NULL; | |
59 PerfCounter* ClassLoader::_perf_class_parse_selftime = NULL; | |
60 PerfCounter* ClassLoader::_perf_sys_class_lookup_time = NULL; | |
61 PerfCounter* ClassLoader::_perf_shared_classload_time = NULL; | |
62 PerfCounter* ClassLoader::_perf_sys_classload_time = NULL; | |
63 PerfCounter* ClassLoader::_perf_app_classload_time = NULL; | |
64 PerfCounter* ClassLoader::_perf_app_classload_selftime = NULL; | |
65 PerfCounter* ClassLoader::_perf_app_classload_count = NULL; | |
66 PerfCounter* ClassLoader::_perf_define_appclasses = NULL; | |
67 PerfCounter* ClassLoader::_perf_define_appclass_time = NULL; | |
68 PerfCounter* ClassLoader::_perf_define_appclass_selftime = NULL; | |
69 PerfCounter* ClassLoader::_perf_app_classfile_bytes_read = NULL; | |
70 PerfCounter* ClassLoader::_perf_sys_classfile_bytes_read = NULL; | |
54 PerfCounter* ClassLoader::_sync_systemLoaderLockContentionRate = NULL; | 71 PerfCounter* ClassLoader::_sync_systemLoaderLockContentionRate = NULL; |
55 PerfCounter* ClassLoader::_sync_nonSystemLoaderLockContentionRate = NULL; | 72 PerfCounter* ClassLoader::_sync_nonSystemLoaderLockContentionRate = NULL; |
56 PerfCounter* ClassLoader::_sync_JVMFindLoadedClassLockFreeCounter = NULL; | 73 PerfCounter* ClassLoader::_sync_JVMFindLoadedClassLockFreeCounter = NULL; |
57 PerfCounter* ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL; | 74 PerfCounter* ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL; |
58 PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL; | 75 PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL; |
150 size_t num_read = os::read(file_handle, (char*) buffer, st.st_size); | 167 size_t num_read = os::read(file_handle, (char*) buffer, st.st_size); |
151 // close file | 168 // close file |
152 hpi::close(file_handle); | 169 hpi::close(file_handle); |
153 // construct ClassFileStream | 170 // construct ClassFileStream |
154 if (num_read == (size_t)st.st_size) { | 171 if (num_read == (size_t)st.st_size) { |
172 if (UsePerfData) { | |
173 ClassLoader::perf_sys_classfile_bytes_read()->inc(num_read); | |
174 } | |
155 return new ClassFileStream(buffer, st.st_size, _dir); // Resource allocated | 175 return new ClassFileStream(buffer, st.st_size, _dir); // Resource allocated |
156 } | 176 } |
157 } | 177 } |
158 } | 178 } |
159 return NULL; | 179 return NULL; |
195 !(*ReadMappedEntry)(_zip, entry, &buffer, filename)) { | 215 !(*ReadMappedEntry)(_zip, entry, &buffer, filename)) { |
196 // mmaped access not available, perhaps due to compression, | 216 // mmaped access not available, perhaps due to compression, |
197 // read contents into resource array | 217 // read contents into resource array |
198 buffer = NEW_RESOURCE_ARRAY(u1, filesize); | 218 buffer = NEW_RESOURCE_ARRAY(u1, filesize); |
199 if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL; | 219 if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL; |
220 } | |
221 if (UsePerfData) { | |
222 ClassLoader::perf_sys_classfile_bytes_read()->inc(filesize); | |
200 } | 223 } |
201 // return result | 224 // return result |
202 return new ClassFileStream(buffer, filesize, _zip_name); // Resource allocated | 225 return new ClassFileStream(buffer, filesize, _zip_name); // Resource allocated |
203 } | 226 } |
204 | 227 |
823 | 846 |
824 // Lookup stream for parsing .class file | 847 // Lookup stream for parsing .class file |
825 ClassFileStream* stream = NULL; | 848 ClassFileStream* stream = NULL; |
826 int classpath_index = 0; | 849 int classpath_index = 0; |
827 { | 850 { |
828 PerfTraceTime vmtimer(perf_accumulated_time()); | 851 PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(), |
852 ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(), | |
853 PerfClassTraceTime::CLASS_LOAD); | |
829 ClassPathEntry* e = _first_entry; | 854 ClassPathEntry* e = _first_entry; |
830 while (e != NULL) { | 855 while (e != NULL) { |
831 stream = e->open_stream(name); | 856 stream = e->open_stream(name); |
832 if (stream != NULL) { | 857 if (stream != NULL) { |
833 break; | 858 break; |
888 | 913 |
889 if (UsePerfData) { | 914 if (UsePerfData) { |
890 // jvmstat performance counters | 915 // jvmstat performance counters |
891 NEWPERFTICKCOUNTER(_perf_accumulated_time, SUN_CLS, "time"); | 916 NEWPERFTICKCOUNTER(_perf_accumulated_time, SUN_CLS, "time"); |
892 NEWPERFTICKCOUNTER(_perf_class_init_time, SUN_CLS, "classInitTime"); | 917 NEWPERFTICKCOUNTER(_perf_class_init_time, SUN_CLS, "classInitTime"); |
918 NEWPERFTICKCOUNTER(_perf_class_init_selftime, SUN_CLS, "classInitTime.self"); | |
893 NEWPERFTICKCOUNTER(_perf_class_verify_time, SUN_CLS, "classVerifyTime"); | 919 NEWPERFTICKCOUNTER(_perf_class_verify_time, SUN_CLS, "classVerifyTime"); |
920 NEWPERFTICKCOUNTER(_perf_class_verify_selftime, SUN_CLS, "classVerifyTime.self"); | |
894 NEWPERFTICKCOUNTER(_perf_class_link_time, SUN_CLS, "classLinkedTime"); | 921 NEWPERFTICKCOUNTER(_perf_class_link_time, SUN_CLS, "classLinkedTime"); |
895 | 922 NEWPERFTICKCOUNTER(_perf_class_link_selftime, SUN_CLS, "classLinkedTime.self"); |
896 NEWPERFEVENTCOUNTER(_perf_classes_inited, SUN_CLS, "initializedClasses"); | 923 NEWPERFEVENTCOUNTER(_perf_classes_inited, SUN_CLS, "initializedClasses"); |
897 NEWPERFEVENTCOUNTER(_perf_classes_linked, SUN_CLS, "linkedClasses"); | 924 NEWPERFEVENTCOUNTER(_perf_classes_linked, SUN_CLS, "linkedClasses"); |
925 NEWPERFEVENTCOUNTER(_perf_classes_verified, SUN_CLS, "verifiedClasses"); | |
926 | |
927 NEWPERFTICKCOUNTER(_perf_class_parse_time, SUN_CLS, "parseClassTime"); | |
928 NEWPERFTICKCOUNTER(_perf_class_parse_selftime, SUN_CLS, "parseClassTime.self"); | |
929 NEWPERFTICKCOUNTER(_perf_sys_class_lookup_time, SUN_CLS, "lookupSysClassTime"); | |
930 NEWPERFTICKCOUNTER(_perf_shared_classload_time, SUN_CLS, "sharedClassLoadTime"); | |
931 NEWPERFTICKCOUNTER(_perf_sys_classload_time, SUN_CLS, "sysClassLoadTime"); | |
932 NEWPERFTICKCOUNTER(_perf_app_classload_time, SUN_CLS, "appClassLoadTime"); | |
933 NEWPERFTICKCOUNTER(_perf_app_classload_selftime, SUN_CLS, "appClassLoadTime.self"); | |
934 NEWPERFEVENTCOUNTER(_perf_app_classload_count, SUN_CLS, "appClassLoadCount"); | |
935 NEWPERFTICKCOUNTER(_perf_define_appclasses, SUN_CLS, "defineAppClasses"); | |
936 NEWPERFTICKCOUNTER(_perf_define_appclass_time, SUN_CLS, "defineAppClassTime"); | |
937 NEWPERFTICKCOUNTER(_perf_define_appclass_selftime, SUN_CLS, "defineAppClassTime.self"); | |
938 NEWPERFBYTECOUNTER(_perf_app_classfile_bytes_read, SUN_CLS, "appClassBytes"); | |
939 NEWPERFBYTECOUNTER(_perf_sys_classfile_bytes_read, SUN_CLS, "sysClassBytes"); | |
940 | |
898 | 941 |
899 // The following performance counters are added for measuring the impact | 942 // The following performance counters are added for measuring the impact |
900 // of the bug fix of 6365597. They are mainly focused on finding out | 943 // of the bug fix of 6365597. They are mainly focused on finding out |
901 // the behavior of system & user-defined classloader lock, whether | 944 // the behavior of system & user-defined classloader lock, whether |
902 // ClassLoader.loadClass/findClass is being called synchronized or not. | 945 // ClassLoader.loadClass/findClass is being called synchronized or not. |