Skip to content
Permalink
Browse files

8241585: Remove unused _recursion_counter facility from PerfTraceTime

8241705: Tune PerfData collections

Reviewed-by: iklam, dholmes
  • Loading branch information
cl4es committed Apr 3, 2020
1 parent fe2a820 commit a30904602863d035526e2268f7822650cb0dc962
@@ -276,6 +276,9 @@ void PerfDataManager::destroy() {
_has_PerfData = false;
os::naked_short_sleep(1); // 1ms sleep to let other thread(s) run

log_debug(perf, datacreation)("Total = %d, Sampled = %d, Constants = %d",
_all->length(), _sampled->length(), _constants->length());

for (int index = 0; index < _all->length(); index++) {
PerfData* p = _all->at(index);
delete p;
@@ -294,8 +297,9 @@ void PerfDataManager::add_item(PerfData* p, bool sampled) {

MutexLocker ml(PerfDataManager_lock);

// Default sizes determined using -Xlog:perf+datacreation=debug
if (_all == NULL) {
_all = new PerfDataList(100);
_all = new PerfDataList(191);
_has_PerfData = true;
}

@@ -306,29 +310,20 @@ void PerfDataManager::add_item(PerfData* p, bool sampled) {

if (p->variability() == PerfData::V_Constant) {
if (_constants == NULL) {
_constants = new PerfDataList(25);
_constants = new PerfDataList(51);
}
_constants->append(p);
return;
}

if (sampled) {
if (_sampled == NULL) {
_sampled = new PerfDataList(25);
_sampled = new PerfDataList(1);
}
_sampled->append(p);
}
}

PerfData* PerfDataManager::find_by_name(const char* name) {
// if add_item hasn't been called the list won't be initialized
if (_all != NULL) {
return _all->find_by_name(name);
} else {
return NULL;
}
}

PerfDataList* PerfDataManager::all() {

MutexLocker ml(PerfDataManager_lock);
@@ -612,8 +607,7 @@ PerfDataList* PerfDataList::clone() {
}

PerfTraceTime::~PerfTraceTime() {
if (!UsePerfData || (_recursion_counter != NULL &&
--(*_recursion_counter) > 0)) return;
if (!UsePerfData) return;
_t.stop();
_timerp->inc(_t.ticks());
}
@@ -428,7 +428,6 @@ class PerfLongVariant : public PerfLong {
inline void inc(jlong val) { (*(jlong*)_valuep) += val; }
inline void dec(jlong val) { inc(-val); }
inline void add(jlong val) { (*(jlong*)_valuep) += val; }
void clear_sample_helper() { _sample_helper = NULL; }
};

/*
@@ -684,22 +683,17 @@ class PerfDataManager : AllStatic {
// return the list of all known PerfData items that are to be
// sampled by the StatSampler.
static PerfDataList* sampled();
static inline int sampled_count();

// return the list of all known PerfData items that have a
// variability classification of type Constant
static PerfDataList* constants();
static inline int constants_count();

public:

// method to check for the existence of a PerfData item with
// the given name.
static inline bool exists(const char* name);

// method to search for a instrumentation object by name
static PerfData* find_by_name(const char* name);

// method to map a CounterNS enumeration to a namespace string
static const char* ns_to_string(CounterNS ns) {
return _name_spaces[ns];
@@ -713,9 +707,6 @@ class PerfDataManager : AllStatic {
static bool is_unstable_supported(CounterNS ns) {
return (ns != NULL_NS) && ((ns % 3) == COM_NS);
}
static bool is_unstable_unsupported(CounterNS ns) {
return (ns == NULL_NS) || ((ns % 3) == SUN_NS);
}

// methods to test the interface stability of a given counter name
//
@@ -727,9 +718,6 @@ class PerfDataManager : AllStatic {
const char* comdot = "com.sun.";
return strncmp(name, comdot, strlen(comdot)) == 0;
}
static bool is_unstable_unsupported(const char* name) {
return !(is_stable_supported(name) && is_unstable_supported(name));
}

// method to construct counter name strings in a given name space.
// The string object is allocated from the Resource Area and calls
@@ -913,21 +901,13 @@ class PerfTraceTime : public StackObj {
protected:
elapsedTimer _t;
PerfLongCounter* _timerp;
// pointer to thread-local or global recursion counter variable
int* _recursion_counter;

public:
inline PerfTraceTime(PerfLongCounter* timerp) : _timerp(timerp), _recursion_counter(NULL) {
inline PerfTraceTime(PerfLongCounter* timerp) : _timerp(timerp) {
if (!UsePerfData) return;
_t.start();
}

inline PerfTraceTime(PerfLongCounter* timerp, int* recursion_counter) : _timerp(timerp), _recursion_counter(recursion_counter) {
if (!UsePerfData || (_recursion_counter != NULL &&
(*_recursion_counter)++ > 0)) return;
_t.start();
}

inline void suspend() { if (!UsePerfData) return; _t.stop(); }
inline void resume() { if (!UsePerfData) return; _t.start(); }

@@ -964,10 +944,6 @@ class PerfTraceTimedEvent : public PerfTraceTime {
_eventp->inc();
}

inline PerfTraceTimedEvent(PerfLongCounter* timerp, PerfLongCounter* eventp, int* recursion_counter): PerfTraceTime(timerp, recursion_counter), _eventp(eventp) {
if (!UsePerfData) return;
_eventp->inc();
}
};

#endif // SHARE_RUNTIME_PERFDATA_HPP
@@ -49,14 +49,6 @@ inline int PerfDataManager::count() {
return _all->length();
}

inline int PerfDataManager::sampled_count() {
return _sampled->length();
}

inline int PerfDataManager::constants_count() {
return _constants->length();
}

inline bool PerfDataManager::exists(const char* name) {
if (_all != NULL) {
return _all->contains(name);

0 comments on commit a309046

Please sign in to comment.