/* * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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. *
*/
// KlassInfoTable is a bucket hash table that // maps Klass*s to extra information: // instance count and instance word size. // // A KlassInfoBucket is the head of a link list // of KlassInfoEntry's // // KlassInfoHisto is a growable array of pointers // to KlassInfoEntry's and is used to sort // the entries.
class KlassInfoEntry: public CHeapObj<mtInternal> { private:
KlassInfoEntry* _next;
Klass* _klass;
uint64_t _instance_count;
size_t _instance_words;
int64_t _index; bool _do_print; // True if we should print this class when printing the class hierarchy.
GrowableArray<KlassInfoEntry*>* _subclasses;
staticvoid print_julong(outputStream* st, int width, julong n) { int num_spaces = width - julong_width(n); if (num_spaces > 0) {
st->print("%*s", num_spaces, "");
}
st->print(JULONG_FORMAT, n);
}
staticint julong_width(julong n) { if (n == 0) { return 1;
} int w = 0; while (n > 0) {
n /= 10;
w += 1;
} return w;
}
staticint col_width(julong n, constchar *name) { int w = julong_width(n); int min = (int)(strlen(name)); if (w < min) {
w = min;
} // add a leading space for separation. return w + 1;
}
// These declarations are needed since the declaration of KlassInfoTable and // KlassInfoClosure are guarded by #if INLCUDE_SERVICES class KlassInfoTable; class KlassInfoClosure;
// Parallel heap inspection task. Parallel inspection can fail due to // a native OOM when allocating memory for TL-KlassInfoTable. // _success will be set false on an OOM, and serial inspection tried. class ParHeapInspectTask : public WorkerTask { private:
ParallelObjectIterator* _poi;
KlassInfoTable* _shared_cit;
BoolObjectClosure* _filter;
uintx _missed_count; bool _success;
Mutex _mutex;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.