6995781: Native Memory Tracking (Phase 1)

7151532: DCmd for hotspot native memory tracking

Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd

Reviewed-by: acorn, coleenp, fparain
This commit is contained in:
Zhengyu Gu 2012-06-28 17:03:16 -04:00
parent 8e42425c92
commit a39b17624a
315 changed files with 7245 additions and 1477 deletions

View file

@ -38,7 +38,7 @@
class elapsedTimer;
class CollectorPolicy;
class AdaptiveSizePolicy : public CHeapObj {
class AdaptiveSizePolicy : public CHeapObj<mtGC> {
friend class GCAdaptivePolicyCounters;
friend class PSGCAdaptivePolicyCounters;
friend class CMSGCAdaptivePolicyCounters;

View file

@ -37,7 +37,7 @@ CSpaceCounters::CSpaceCounters(const char* name, int ordinal, size_t max_size,
const char* cns = PerfDataManager::name_space(gc->name_space(), "space",
ordinal);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
strcpy(_name_space, cns);
const char* cname = PerfDataManager::counter_name(_name_space, "name");

View file

@ -32,7 +32,7 @@
// A CSpaceCounters is a holder class for performance counters
// that track a space;
class CSpaceCounters: public CHeapObj {
class CSpaceCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@ -52,7 +52,7 @@ class CSpaceCounters: public CHeapObj {
ContiguousSpace* s, GenerationCounters* gc);
~CSpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtInternal);
}
inline void update_capacity() {

View file

@ -34,7 +34,7 @@ CollectorCounters::CollectorCounters(const char* name, int ordinal) {
const char* cns = PerfDataManager::name_space("collector", ordinal);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
strcpy(_name_space, cns);
char* cname = PerfDataManager::counter_name(_name_space, "name");

View file

@ -30,7 +30,7 @@
// CollectorCounters is a holder class for performance counters
// that track a collector
class CollectorCounters: public CHeapObj {
class CollectorCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@ -50,7 +50,7 @@ class CollectorCounters: public CHeapObj {
CollectorCounters(const char* name, int ordinal);
~CollectorCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
}
inline PerfCounter* invocation_counter() const { return _invocations; }

View file

@ -41,7 +41,7 @@ GSpaceCounters::GSpaceCounters(const char* name, int ordinal, size_t max_size,
const char* cns = PerfDataManager::name_space(gc->name_space(), "space",
ordinal);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
strcpy(_name_space, cns);
const char* cname = PerfDataManager::counter_name(_name_space, "name");

View file

@ -34,7 +34,7 @@
// A GSpaceCounter is a holder class for performance counters
// that track a space;
class GSpaceCounters: public CHeapObj {
class GSpaceCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@ -54,7 +54,7 @@ class GSpaceCounters: public CHeapObj {
GenerationCounters* gc, bool sampled=true);
~GSpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
}
inline void update_capacity() {

View file

@ -30,7 +30,7 @@
// GCPolicyCounters is a holder class for performance counters
// that track a generation
class GCPolicyCounters: public CHeapObj {
class GCPolicyCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:

View file

@ -27,7 +27,7 @@
#include "gc_implementation/shared/gcUtil.hpp"
class GCStats : public CHeapObj {
class GCStats : public CHeapObj<mtGC> {
protected:
// Avg amount promoted; used for avoiding promotion undo
// This class does not update deviations if the sample is zero.

View file

@ -43,7 +43,7 @@
//
// This serves as our best estimate of a future unknown.
//
class AdaptiveWeightedAverage : public CHeapObj {
class AdaptiveWeightedAverage : public CHeapObj<mtGC> {
private:
float _average; // The last computed average
unsigned _sample_count; // How often we've sampled this average
@ -146,7 +146,7 @@ class AdaptivePaddedAverage : public AdaptiveWeightedAverage {
// Placement support
void* operator new(size_t ignored, void* p) { return p; }
// Allocator
void* operator new(size_t size) { return CHeapObj::operator new(size); }
void* operator new(size_t size) { return CHeapObj<mtGC>::operator new(size); }
// Accessor
float padded_average() const { return _padded_avg; }
@ -192,7 +192,7 @@ public:
// equation.
// y = intercept + slope * x
class LinearLeastSquareFit : public CHeapObj {
class LinearLeastSquareFit : public CHeapObj<mtGC> {
double _sum_x; // sum of all independent data points x
double _sum_x_squared; // sum of all independent data points x**2
double _sum_y; // sum of all dependent data points y

View file

@ -35,7 +35,7 @@ void GenerationCounters::initialize(const char* name, int ordinal, int spaces,
const char* cns = PerfDataManager::name_space("generation", ordinal);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
strcpy(_name_space, cns);
const char* cname = PerfDataManager::counter_name(_name_space, "name");

View file

@ -31,7 +31,7 @@
// A GenerationCounter is a holder class for performance counters
// that track a generation
class GenerationCounters: public CHeapObj {
class GenerationCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@ -69,7 +69,7 @@ private:
VirtualSpace* v);
~GenerationCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
}
virtual void update_all();

View file

@ -40,7 +40,7 @@ HSpaceCounters::HSpaceCounters(const char* name,
const char* cns =
PerfDataManager::name_space(gc->name_space(), "space", ordinal);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
strcpy(_name_space, cns);
const char* cname = PerfDataManager::counter_name(_name_space, "name");

View file

@ -37,7 +37,7 @@
class HeapSpaceUsedHelper;
class G1SpaceMonitoringSupport;
class HSpaceCounters: public CHeapObj {
class HSpaceCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@ -55,7 +55,7 @@ class HSpaceCounters: public CHeapObj {
size_t initial_capacity, GenerationCounters* gc);
~HSpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
}
inline void update_capacity(size_t v) {

View file

@ -33,7 +33,7 @@
// Invariant: bottom() and end() are on page_size boundaries and
// bottom() <= end()
class ImmutableSpace: public CHeapObj {
class ImmutableSpace: public CHeapObj<mtGC> {
friend class VMStructs;
protected:
HeapWord* _bottom;

View file

@ -30,13 +30,13 @@
#include "oops/objArrayKlass.inline.hpp"
#include "oops/oop.inline.hpp"
Stack<oop> MarkSweep::_marking_stack;
Stack<DataLayout*> MarkSweep::_revisit_mdo_stack;
Stack<Klass*> MarkSweep::_revisit_klass_stack;
Stack<ObjArrayTask> MarkSweep::_objarray_stack;
Stack<oop, mtGC> MarkSweep::_marking_stack;
Stack<DataLayout*, mtGC> MarkSweep::_revisit_mdo_stack;
Stack<Klass*, mtGC> MarkSweep::_revisit_klass_stack;
Stack<ObjArrayTask, mtGC> MarkSweep::_objarray_stack;
Stack<oop> MarkSweep::_preserved_oop_stack;
Stack<markOop> MarkSweep::_preserved_mark_stack;
Stack<oop, mtGC> MarkSweep::_preserved_oop_stack;
Stack<markOop, mtGC> MarkSweep::_preserved_mark_stack;
size_t MarkSweep::_preserved_count = 0;
size_t MarkSweep::_preserved_count_max = 0;
PreservedMark* MarkSweep::_preserved_marks = NULL;
@ -166,7 +166,7 @@ void MarkSweep::adjust_marks() {
}
// deal with the overflow stack
StackIterator<oop> iter(_preserved_oop_stack);
StackIterator<oop, mtGC> iter(_preserved_oop_stack);
while (!iter.is_empty()) {
oop* p = iter.next_addr();
adjust_pointer(p);

View file

@ -122,16 +122,16 @@ class MarkSweep : AllStatic {
//
protected:
// Traversal stacks used during phase1
static Stack<oop> _marking_stack;
static Stack<ObjArrayTask> _objarray_stack;
static Stack<oop, mtGC> _marking_stack;
static Stack<ObjArrayTask, mtGC> _objarray_stack;
// Stack for live klasses to revisit at end of marking phase
static Stack<Klass*> _revisit_klass_stack;
static Stack<Klass*, mtGC> _revisit_klass_stack;
// Set (stack) of MDO's to revisit at end of marking phase
static Stack<DataLayout*> _revisit_mdo_stack;
static Stack<DataLayout*, mtGC> _revisit_mdo_stack;
// Space for storing/restoring mark word
static Stack<markOop> _preserved_mark_stack;
static Stack<oop> _preserved_oop_stack;
static Stack<markOop, mtGC> _preserved_mark_stack;
static Stack<oop, mtGC> _preserved_oop_stack;
static size_t _preserved_count;
static size_t _preserved_count_max;
static PreservedMark* _preserved_marks;

View file

@ -43,7 +43,7 @@
MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
_lgrp_spaces = new (ResourceObj::C_HEAP) GrowableArray<LGRPSpace*>(0, true);
_lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray<LGRPSpace*>(0, true);
_page_size = os::vm_page_size();
_adaptation_cycles = 0;
_samples_count = 0;
@ -231,7 +231,7 @@ bool MutableNUMASpace::update_layout(bool force) {
if (force || changed) {
// Compute lgrp intersection. Add/remove spaces.
int lgrp_limit = (int)os::numa_get_groups_num();
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit);
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtGC);
int lgrp_num = (int)os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
assert(lgrp_num > 0, "There should be at least one locality group");
// Add new spaces for the new nodes
@ -265,7 +265,7 @@ bool MutableNUMASpace::update_layout(bool force) {
}
}
FREE_C_HEAP_ARRAY(int, lgrp_ids);
FREE_C_HEAP_ARRAY(int, lgrp_ids, mtGC);
if (changed) {
for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) {

View file

@ -63,7 +63,7 @@
class MutableNUMASpace : public MutableSpace {
friend class VMStructs;
class LGRPSpace : public CHeapObj {
class LGRPSpace : public CHeapObj<mtGC> {
int _lgrp_id;
MutableSpace* _space;
MemRegion _invalid_region;

View file

@ -39,7 +39,7 @@ SpaceCounters::SpaceCounters(const char* name, int ordinal, size_t max_size,
const char* cns = PerfDataManager::name_space(gc->name_space(), "space",
ordinal);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1);
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
strcpy(_name_space, cns);
const char* cname = PerfDataManager::counter_name(_name_space, "name");

View file

@ -35,7 +35,7 @@
// A SpaceCounter is a holder class for performance counters
// that track a space;
class SpaceCounters: public CHeapObj {
class SpaceCounters: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@ -55,7 +55,7 @@ class SpaceCounters: public CHeapObj {
MutableSpace* m, GenerationCounters* gc);
~SpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
}
inline void update_capacity() {

View file

@ -70,7 +70,7 @@ class SpaceDecorator: public AllStatic {
// These subclasses abstract the differences in the types of spaces used
// by each heap.
class SpaceMangler: public CHeapObj {
class SpaceMangler: public CHeapObj<mtGC> {
friend class VMStructs;
// High water mark for allocations. Typically, the space above