heapInspection.cpp revision 2273
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/heapInspection.hpp"
#include "memory/resourceArea.hpp"
#include "oops/klassOop.hpp"
#include "utilities/globalDefinitions.hpp"
#ifndef SERIALGC
#endif
// HeapInspection
return -1;
return 1;
}
return 0;
}
const char* name;;
} else {
name = "<no name>";
}
// simplify the formatting (ILP32 vs LP64) - always cast the numbers to 64-bit
name);
}
return elt;
}
}
// We may be out of space to allocate the new entry.
}
return elt;
}
}
}
void KlassInfoBucket::empty() {
delete elt;
}
}
_size = 0;
}
}
}
KlassInfoTable::~KlassInfoTable() {
}
_size = 0;
}
}
}
// Lookup may fail if this is a new klass for which we
// could not allocate space for an new entry.
return e;
}
// Return false if the entry could not be recorded on account
// of running out of space required to create a new entry.
// elt may be NULL if it's a new klass for which we
// could not allocate space for a new entry in the hashtable.
return true;
} else {
return false;
}
}
}
}
}
}
KlassInfoHisto::~KlassInfoHisto() {
delete _elements;
}
}
void KlassInfoHisto::sort() {
}
// simplify the formatting (ILP32 vs LP64) - store the sum in 64-bit
}
}
}
class HistoClosure : public KlassInfoClosure {
private:
public:
}
};
class RecordInstanceClosure : public ObjectClosure {
private:
public:
}
}
};
bool is_shared_heap = false;
case CollectedHeap::G1CollectedHeap:
case CollectedHeap::GenCollectedHeap: {
is_shared_heap = true;
if (need_prologue) {
}
break;
}
#ifndef SERIALGC
case CollectedHeap::ParallelScavengeHeap: {
break;
}
#endif // SERIALGC
default:
ShouldNotReachHere(); // Unexpected heap kind for this op
}
// Collect klass instance info
if (!cit.allocation_failed()) {
// Iterate over objects in the heap
// If this operation encounters a bad object when using CMS,
// consider using safe_object_iterate() which avoids perm gen
// objects that may contain bad references.
// Report if certain classes are not counted because of
// running out of C-heap for the histogram.
if (missed_count != 0) {
" total instances in data below",
}
// Sort and print klass instance info
" num #instances #bytes class name\n"
"----------------------------------------------",
} else {
}
if (need_prologue && is_shared_heap) {
}
}
class FindInstanceClosure : public ObjectClosure {
private:
public:
}
}
};
// Ensure that the heap is parsable
// Iterate over objects in the heap
// If this operation encounters a bad object when using CMS,
// consider using safe_object_iterate() which avoids perm gen
// objects that may contain bad references.
}