8241585: Remove unused _recursion_counter facility from PerfTraceTime

8241705: Tune PerfData collections

Reviewed-by: iklam, dholmes
This commit is contained in:
Claes Redestad 2020-04-03 17:20:53 +02:00
parent fe2a82031f
commit a309046028
3 changed files with 9 additions and 47 deletions

View File

@ -276,6 +276,9 @@ void PerfDataManager::destroy() {
_has_PerfData = false; _has_PerfData = false;
os::naked_short_sleep(1); // 1ms sleep to let other thread(s) run 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++) { for (int index = 0; index < _all->length(); index++) {
PerfData* p = _all->at(index); PerfData* p = _all->at(index);
delete p; delete p;
@ -294,8 +297,9 @@ void PerfDataManager::add_item(PerfData* p, bool sampled) {
MutexLocker ml(PerfDataManager_lock); MutexLocker ml(PerfDataManager_lock);
// Default sizes determined using -Xlog:perf+datacreation=debug
if (_all == NULL) { if (_all == NULL) {
_all = new PerfDataList(100); _all = new PerfDataList(191);
_has_PerfData = true; _has_PerfData = true;
} }
@ -306,7 +310,7 @@ void PerfDataManager::add_item(PerfData* p, bool sampled) {
if (p->variability() == PerfData::V_Constant) { if (p->variability() == PerfData::V_Constant) {
if (_constants == NULL) { if (_constants == NULL) {
_constants = new PerfDataList(25); _constants = new PerfDataList(51);
} }
_constants->append(p); _constants->append(p);
return; return;
@ -314,21 +318,12 @@ void PerfDataManager::add_item(PerfData* p, bool sampled) {
if (sampled) { if (sampled) {
if (_sampled == NULL) { if (_sampled == NULL) {
_sampled = new PerfDataList(25); _sampled = new PerfDataList(1);
} }
_sampled->append(p); _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() { PerfDataList* PerfDataManager::all() {
MutexLocker ml(PerfDataManager_lock); MutexLocker ml(PerfDataManager_lock);
@ -612,8 +607,7 @@ PerfDataList* PerfDataList::clone() {
} }
PerfTraceTime::~PerfTraceTime() { PerfTraceTime::~PerfTraceTime() {
if (!UsePerfData || (_recursion_counter != NULL && if (!UsePerfData) return;
--(*_recursion_counter) > 0)) return;
_t.stop(); _t.stop();
_timerp->inc(_t.ticks()); _timerp->inc(_t.ticks());
} }

View File

@ -428,7 +428,6 @@ class PerfLongVariant : public PerfLong {
inline void inc(jlong val) { (*(jlong*)_valuep) += val; } inline void inc(jlong val) { (*(jlong*)_valuep) += val; }
inline void dec(jlong val) { inc(-val); } inline void dec(jlong val) { inc(-val); }
inline void add(jlong val) { (*(jlong*)_valuep) += val; } inline void add(jlong val) { (*(jlong*)_valuep) += val; }
void clear_sample_helper() { _sample_helper = NULL; }
}; };
/* /*
@ -684,12 +683,10 @@ class PerfDataManager : AllStatic {
// return the list of all known PerfData items that are to be // return the list of all known PerfData items that are to be
// sampled by the StatSampler. // sampled by the StatSampler.
static PerfDataList* sampled(); static PerfDataList* sampled();
static inline int sampled_count();
// return the list of all known PerfData items that have a // return the list of all known PerfData items that have a
// variability classification of type Constant // variability classification of type Constant
static PerfDataList* constants(); static PerfDataList* constants();
static inline int constants_count();
public: public:
@ -697,9 +694,6 @@ class PerfDataManager : AllStatic {
// the given name. // the given name.
static inline bool exists(const char* 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 // method to map a CounterNS enumeration to a namespace string
static const char* ns_to_string(CounterNS ns) { static const char* ns_to_string(CounterNS ns) {
return _name_spaces[ns]; return _name_spaces[ns];
@ -713,9 +707,6 @@ class PerfDataManager : AllStatic {
static bool is_unstable_supported(CounterNS ns) { static bool is_unstable_supported(CounterNS ns) {
return (ns != NULL_NS) && ((ns % 3) == COM_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 // methods to test the interface stability of a given counter name
// //
@ -727,9 +718,6 @@ class PerfDataManager : AllStatic {
const char* comdot = "com.sun."; const char* comdot = "com.sun.";
return strncmp(name, comdot, strlen(comdot)) == 0; 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. // method to construct counter name strings in a given name space.
// The string object is allocated from the Resource Area and calls // The string object is allocated from the Resource Area and calls
@ -913,21 +901,13 @@ class PerfTraceTime : public StackObj {
protected: protected:
elapsedTimer _t; elapsedTimer _t;
PerfLongCounter* _timerp; PerfLongCounter* _timerp;
// pointer to thread-local or global recursion counter variable
int* _recursion_counter;
public: public:
inline PerfTraceTime(PerfLongCounter* timerp) : _timerp(timerp), _recursion_counter(NULL) { inline PerfTraceTime(PerfLongCounter* timerp) : _timerp(timerp) {
if (!UsePerfData) return; if (!UsePerfData) return;
_t.start(); _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 suspend() { if (!UsePerfData) return; _t.stop(); }
inline void resume() { if (!UsePerfData) return; _t.start(); } inline void resume() { if (!UsePerfData) return; _t.start(); }
@ -964,10 +944,6 @@ class PerfTraceTimedEvent : public PerfTraceTime {
_eventp->inc(); _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 #endif // SHARE_RUNTIME_PERFDATA_HPP

View File

@ -49,14 +49,6 @@ inline int PerfDataManager::count() {
return _all->length(); 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) { inline bool PerfDataManager::exists(const char* name) {
if (_all != NULL) { if (_all != NULL) {
return _all->contains(name); return _all->contains(name);