1.1 --- a/src/share/vm/runtime/aprofiler.cpp Fri Aug 31 16:39:35 2012 -0700 1.2 +++ b/src/share/vm/runtime/aprofiler.cpp Sat Sep 01 13:25:18 2012 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,7 +25,6 @@ 1.11 #include "precompiled.hpp" 1.12 #include "classfile/systemDictionary.hpp" 1.13 #include "gc_interface/collectedHeap.inline.hpp" 1.14 -#include "memory/permGen.hpp" 1.15 #include "memory/resourceArea.hpp" 1.16 #include "memory/space.hpp" 1.17 #include "oops/oop.inline.hpp" 1.18 @@ -34,35 +33,19 @@ 1.19 1.20 1.21 bool AllocationProfiler::_active = false; 1.22 -GrowableArray<klassOop>* AllocationProfiler::_print_array = NULL; 1.23 +GrowableArray<Klass*>* AllocationProfiler::_print_array = NULL; 1.24 1.25 1.26 class AllocProfClosure : public ObjectClosure { 1.27 public: 1.28 void do_object(oop obj) { 1.29 - Klass* k = obj->blueprint(); 1.30 + Klass* k = obj->klass(); 1.31 k->set_alloc_count(k->alloc_count() + 1); 1.32 k->set_alloc_size(k->alloc_size() + obj->size()); 1.33 } 1.34 }; 1.35 1.36 1.37 -#ifndef PRODUCT 1.38 - 1.39 -class AllocProfResetClosure : public ObjectClosure { 1.40 - public: 1.41 - void do_object(oop obj) { 1.42 - if (obj->is_klass()) { 1.43 - Klass* k = Klass::cast(klassOop(obj)); 1.44 - k->set_alloc_count(0); 1.45 - k->set_alloc_size(0); 1.46 - } 1.47 - } 1.48 -}; 1.49 - 1.50 -#endif 1.51 - 1.52 - 1.53 void AllocationProfiler::iterate_since_last_gc() { 1.54 if (is_active()) { 1.55 AllocProfClosure blk; 1.56 @@ -82,20 +65,20 @@ 1.57 } 1.58 1.59 1.60 -void AllocationProfiler::add_class_to_array(klassOop k) { 1.61 +void AllocationProfiler::add_class_to_array(Klass* k) { 1.62 _print_array->append(k); 1.63 } 1.64 1.65 1.66 -void AllocationProfiler::add_classes_to_array(klassOop k) { 1.67 +void AllocationProfiler::add_classes_to_array(Klass* k) { 1.68 // Iterate over klass and all array klasses for klass 1.69 - k->klass_part()->with_array_klasses_do(&AllocationProfiler::add_class_to_array); 1.70 + k->with_array_klasses_do(&AllocationProfiler::add_class_to_array); 1.71 } 1.72 1.73 1.74 -int AllocationProfiler::compare_classes(klassOop* k1, klassOop* k2) { 1.75 +int AllocationProfiler::compare_classes(Klass** k1, Klass** k2) { 1.76 // Sort by total allocation size 1.77 - return (*k2)->klass_part()->alloc_size() - (*k1)->klass_part()->alloc_size(); 1.78 + return (*k2)->alloc_size() - (*k1)->alloc_size(); 1.79 } 1.80 1.81 1.82 @@ -113,14 +96,14 @@ 1.83 size_t total_alloc_size = 0; 1.84 int total_alloc_count = 0; 1.85 for (int index = 0; index < _print_array->length(); index++) { 1.86 - klassOop k = _print_array->at(index); 1.87 - size_t alloc_size = k->klass_part()->alloc_size(); 1.88 + Klass* k = _print_array->at(index); 1.89 + size_t alloc_size = k->alloc_size(); 1.90 if (alloc_size > cutoff) { 1.91 - int alloc_count = k->klass_part()->alloc_count(); 1.92 + int alloc_count = k->alloc_count(); 1.93 #ifdef PRODUCT 1.94 - const char* name = k->klass_part()->external_name(); 1.95 + const char* name = k->external_name(); 1.96 #else 1.97 - const char* name = k->klass_part()->internal_name(); 1.98 + const char* name = k->internal_name(); 1.99 #endif 1.100 tty->print_cr("%20u %10u %8u %s", 1.101 alloc_size * BytesPerWord, 1.102 @@ -130,6 +113,8 @@ 1.103 total_alloc_size += alloc_size; 1.104 total_alloc_count += alloc_count; 1.105 } 1.106 + k->set_alloc_count(0); 1.107 + k->set_alloc_size(0); 1.108 } 1.109 tty->print_cr("%20u %10u %8u --total--", 1.110 total_alloc_size * BytesPerWord, 1.111 @@ -148,32 +133,11 @@ 1.112 tty->cr(); 1.113 1.114 // Print regular instance klasses and basic type array klasses 1.115 - _print_array = new GrowableArray<klassOop>(SystemDictionary::number_of_classes()*2); 1.116 + _print_array = new GrowableArray<Klass*>(SystemDictionary::number_of_classes()*2); 1.117 SystemDictionary::classes_do(&add_classes_to_array); 1.118 Universe::basic_type_classes_do(&add_classes_to_array); 1.119 sort_and_print_array(cutoff); 1.120 1.121 - #ifndef PRODUCT 1.122 - tty->print_cr("Allocation profile for system classes (sizes in bytes, cutoff = %d bytes):", cutoff * BytesPerWord); 1.123 - tty->cr(); 1.124 - 1.125 - // Print system klasses (methods, symbols, constant pools, etc.) 1.126 - _print_array = new GrowableArray<klassOop>(64); 1.127 - Universe::system_classes_do(&add_classes_to_array); 1.128 - sort_and_print_array(cutoff); 1.129 - 1.130 - tty->print_cr("Permanent generation dump (sizes in bytes, cutoff = %d bytes):", cutoff * BytesPerWord); 1.131 - tty->cr(); 1.132 - 1.133 - AllocProfResetClosure resetblk; 1.134 - Universe::heap()->permanent_object_iterate(&resetblk); 1.135 - AllocProfClosure blk; 1.136 - Universe::heap()->permanent_object_iterate(&blk); 1.137 - 1.138 - _print_array = new GrowableArray<klassOop>(SystemDictionary::number_of_classes()*2); 1.139 - SystemDictionary::classes_do(&add_classes_to_array); 1.140 - Universe::basic_type_classes_do(&add_classes_to_array); 1.141 - Universe::system_classes_do(&add_classes_to_array); 1.142 - sort_and_print_array(cutoff); 1.143 - #endif 1.144 + // This used to print metadata in the permgen but since there isn't a permgen 1.145 + // anymore, it is not yet implemented. 1.146 }