155 PerfCounter* classbytes_counter = (shared_class ? _shared_classbytes_loaded 156 : _classbytes_loaded); 157 // add the class size 158 size_t size = compute_class_size(k); 159 classbytes_counter->inc(size); 160 } 161 } 162 163 size_t ClassLoadingService::compute_class_size(InstanceKlass* k) { 164 // lifted from ClassStatistics.do_class(Klass* k) 165 166 size_t class_size = 0; 167 168 class_size += k->size(); 169 170 if (k->is_instance_klass()) { 171 class_size += k->methods()->size(); 172 // FIXME: Need to count the contents of methods 173 class_size += k->constants()->size(); 174 class_size += k->local_interfaces()->size(); 175 class_size += k->transitive_interfaces()->size(); 176 // We do not have to count implementors, since we only store one! 177 // FIXME: How should these be accounted for, now when they have moved. 178 //class_size += k->fields()->size(); 179 } 180 return class_size * oopSize; 181 } 182 183 bool ClassLoadingService::set_verbose(bool verbose) { 184 MutexLocker m(Management_lock); 185 // verbose will be set to the previous value 186 LogLevelType level = verbose ? LogLevel::Info : LogLevel::Off; 187 LogConfiguration::configure_stdout(level, false, LOG_TAGS(class, load)); 188 reset_trace_class_unloading(); 189 return verbose; 190 } 191 192 // Caller to this function must own Management_lock 193 void ClassLoadingService::reset_trace_class_unloading() { 194 assert(Management_lock->owned_by_self(), "Must own the Management_lock"); 195 bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose(); | 155 PerfCounter* classbytes_counter = (shared_class ? _shared_classbytes_loaded 156 : _classbytes_loaded); 157 // add the class size 158 size_t size = compute_class_size(k); 159 classbytes_counter->inc(size); 160 } 161 } 162 163 size_t ClassLoadingService::compute_class_size(InstanceKlass* k) { 164 // lifted from ClassStatistics.do_class(Klass* k) 165 166 size_t class_size = 0; 167 168 class_size += k->size(); 169 170 if (k->is_instance_klass()) { 171 class_size += k->methods()->size(); 172 // FIXME: Need to count the contents of methods 173 class_size += k->constants()->size(); 174 class_size += k->local_interfaces()->size(); 175 if (k->transitive_interfaces() != NULL) { 176 class_size += k->transitive_interfaces()->size(); 177 } 178 // We do not have to count implementors, since we only store one! 179 // FIXME: How should these be accounted for, now when they have moved. 180 //class_size += k->fields()->size(); 181 } 182 return class_size * oopSize; 183 } 184 185 bool ClassLoadingService::set_verbose(bool verbose) { 186 MutexLocker m(Management_lock); 187 // verbose will be set to the previous value 188 LogLevelType level = verbose ? LogLevel::Info : LogLevel::Off; 189 LogConfiguration::configure_stdout(level, false, LOG_TAGS(class, load)); 190 reset_trace_class_unloading(); 191 return verbose; 192 } 193 194 // Caller to this function must own Management_lock 195 void ClassLoadingService::reset_trace_class_unloading() { 196 assert(Management_lock->owned_by_self(), "Must own the Management_lock"); 197 bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose(); |