8191860: Add perfData.inline.hpp

Reviewed-by: ehelin, pliden
This commit is contained in:
Stefan Karlsson 2017-11-24 15:21:30 +01:00
parent 5fd6905c94
commit dbc915dcb9
12 changed files with 122 additions and 35 deletions

View File

@ -26,6 +26,7 @@
#define SHARE_VM_CLASSFILE_CLASSLOADER_HPP #define SHARE_VM_CLASSFILE_CLASSLOADER_HPP
#include "jimage.hpp" #include "jimage.hpp"
#include "runtime/handles.hpp"
#include "runtime/orderAccess.hpp" #include "runtime/orderAccess.hpp"
#include "runtime/perfData.hpp" #include "runtime/perfData.hpp"
#include "utilities/exceptions.hpp" #include "utilities/exceptions.hpp"
@ -42,6 +43,7 @@
class JImageFile; class JImageFile;
class ClassFileStream; class ClassFileStream;
class PackageEntry; class PackageEntry;
template <typename T> class GrowableArray;
class ClassPathEntry : public CHeapObj<mtClass> { class ClassPathEntry : public CHeapObj<mtClass> {
private: private:

View File

@ -25,6 +25,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "gc/shared/collectorCounters.hpp" #include "gc/shared/collectorCounters.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "runtime/os.hpp"
CollectorCounters::CollectorCounters(const char* name, int ordinal) { CollectorCounters::CollectorCounters(const char* name, int ordinal) {
@ -59,3 +60,24 @@ CollectorCounters::CollectorCounters(const char* name, int ordinal) {
CHECK); CHECK);
} }
} }
CollectorCounters::~CollectorCounters() {
if (_name_space != NULL) {
FREE_C_HEAP_ARRAY(char, _name_space);
}
}
TraceCollectorStats::TraceCollectorStats(CollectorCounters* c) :
PerfTraceTimedEvent(c->time_counter(), c->invocation_counter()),
_c(c) {
if (UsePerfData) {
_c->last_entry_counter()->set_value(os::elapsed_counter());
}
}
TraceCollectorStats::~TraceCollectorStats() {
if (UsePerfData) {
_c->last_exit_counter()->set_value(os::elapsed_counter());
}
}

View File

@ -49,9 +49,7 @@ class CollectorCounters: public CHeapObj<mtGC> {
CollectorCounters(const char* name, int ordinal); CollectorCounters(const char* name, int ordinal);
~CollectorCounters() { ~CollectorCounters();
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
inline PerfCounter* invocation_counter() const { return _invocations; } inline PerfCounter* invocation_counter() const { return _invocations; }
@ -70,18 +68,9 @@ class TraceCollectorStats: public PerfTraceTimedEvent {
CollectorCounters* _c; CollectorCounters* _c;
public: public:
inline TraceCollectorStats(CollectorCounters* c) : TraceCollectorStats(CollectorCounters* c);
PerfTraceTimedEvent(c->time_counter(), c->invocation_counter()),
_c(c) {
if (UsePerfData) { ~TraceCollectorStats();
_c->last_entry_counter()->set_value(os::elapsed_counter());
}
}
inline ~TraceCollectorStats() {
if (UsePerfData) _c->last_exit_counter()->set_value(os::elapsed_counter());
}
}; };
#endif // SHARE_VM_GC_SHARED_COLLECTORCOUNTERS_HPP #endif // SHARE_VM_GC_SHARED_COLLECTORCOUNTERS_HPP

View File

@ -78,6 +78,12 @@ GenerationCounters::GenerationCounters(const char* name,
initialize(name, ordinal, spaces, min_capacity, max_capacity, curr_capacity); initialize(name, ordinal, spaces, min_capacity, max_capacity, curr_capacity);
} }
GenerationCounters::~GenerationCounters() {
if (_name_space != NULL) {
FREE_C_HEAP_ARRAY(char, _name_space);
}
}
void GenerationCounters::update_all() { void GenerationCounters::update_all() {
assert(_virtual_space != NULL, "otherwise, override this method"); assert(_virtual_space != NULL, "otherwise, override this method");
_current_size->set_value(_virtual_space->committed_size()); _current_size->set_value(_virtual_space->committed_size());

View File

@ -68,9 +68,7 @@ private:
GenerationCounters(const char* name, int ordinal, int spaces, GenerationCounters(const char* name, int ordinal, int spaces,
size_t min_capacity, size_t max_capacity, VirtualSpace* v); size_t min_capacity, size_t max_capacity, VirtualSpace* v);
~GenerationCounters() { ~GenerationCounters();
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
}
virtual void update_all(); virtual void update_all();

View File

@ -30,7 +30,7 @@
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "runtime/interfaceSupport.hpp" #include "runtime/interfaceSupport.hpp"
#include "runtime/perfData.hpp" #include "runtime/perfData.inline.hpp"
#include "runtime/perfMemory.hpp" #include "runtime/perfMemory.hpp"
/* /*

View File

@ -27,6 +27,7 @@
#include "logging/logLevel.hpp" #include "logging/logLevel.hpp"
#include "logging/logTag.hpp" #include "logging/logTag.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/java.hpp" #include "runtime/java.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "runtime/perfData.hpp" #include "runtime/perfData.hpp"

View File

@ -25,6 +25,7 @@
#ifndef SHARE_VM_RUNTIME_OBJECTMONITOR_HPP #ifndef SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
#define SHARE_VM_RUNTIME_OBJECTMONITOR_HPP #define SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
#include "memory/allocation.inline.hpp"
#include "memory/padded.hpp" #include "memory/padded.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "runtime/park.hpp" #include "runtime/park.hpp"

View File

@ -32,7 +32,7 @@
#include "runtime/mutex.hpp" #include "runtime/mutex.hpp"
#include "runtime/mutexLocker.hpp" #include "runtime/mutexLocker.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "runtime/perfData.hpp" #include "runtime/perfData.inline.hpp"
#include "utilities/exceptions.hpp" #include "utilities/exceptions.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
@ -611,3 +611,10 @@ PerfDataList* PerfDataList::clone() {
return copy; return copy;
} }
PerfTraceTime::~PerfTraceTime() {
if (!UsePerfData || (_recursion_counter != NULL &&
--(*_recursion_counter) > 0)) return;
_t.stop();
_timerp->inc(_t.ticks());
}

View File

@ -25,10 +25,11 @@
#ifndef SHARE_VM_RUNTIME_PERFDATA_HPP #ifndef SHARE_VM_RUNTIME_PERFDATA_HPP
#define SHARE_VM_RUNTIME_PERFDATA_HPP #define SHARE_VM_RUNTIME_PERFDATA_HPP
#include "memory/allocation.inline.hpp" #include "memory/allocation.hpp"
#include "runtime/perfMemory.hpp" #include "runtime/perfMemory.hpp"
#include "runtime/timer.hpp" #include "runtime/timer.hpp"
#include "utilities/growableArray.hpp"
template <typename T> class GrowableArray;
/* jvmstat global and subsystem counter name space - enumeration value /* jvmstat global and subsystem counter name space - enumeration value
* serve as an index into the PerfDataManager::_name_space[] array * serve as an index into the PerfDataManager::_name_space[] array
@ -629,10 +630,10 @@ class PerfDataList : public CHeapObj<mtInternal> {
bool contains(const char* name) { return find_by_name(name) != NULL; } bool contains(const char* name) { return find_by_name(name) != NULL; }
// return the number of PerfData items in this list // return the number of PerfData items in this list
int length() { return _set->length(); } inline int length();
// add a PerfData item to this list // add a PerfData item to this list
void append(PerfData *p) { _set->append(p); } inline void append(PerfData *p);
// remove the given PerfData item from this list. When called // remove the given PerfData item from this list. When called
// while iterating over the list, this method will result in a // while iterating over the list, this method will result in a
@ -640,7 +641,7 @@ class PerfDataList : public CHeapObj<mtInternal> {
// method is also impacted by this method as elements with an // method is also impacted by this method as elements with an
// index greater than the index of the element removed by this // index greater than the index of the element removed by this
// method will be shifted down by one. // method will be shifted down by one.
void remove(PerfData *p) { _set->remove(p); } inline void remove(PerfData *p);
// create a new PerfDataList from this list. The new list is // create a new PerfDataList from this list. The new list is
// a shallow copy of the original list and care should be taken // a shallow copy of the original list and care should be taken
@ -651,7 +652,7 @@ class PerfDataList : public CHeapObj<mtInternal> {
// for backward compatibility with GrowableArray - need to implement // for backward compatibility with GrowableArray - need to implement
// some form of iterator to provide a cleaner abstraction for // some form of iterator to provide a cleaner abstraction for
// iteration over the container. // iteration over the container.
PerfData* at(int index) { return _set->at(index); } inline PerfData* at(int index);
}; };
@ -677,23 +678,23 @@ class PerfDataManager : AllStatic {
protected: protected:
// return the list of all known PerfData items // return the list of all known PerfData items
static PerfDataList* all(); static PerfDataList* all();
static int count() { return _all->length(); } static inline int count();
// 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 int sampled_count() { return _sampled->length(); } 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 int constants_count() { return _constants->length(); } static inline int constants_count();
public: public:
// method to check for the existence of a PerfData item with // method to check for the existence of a PerfData item with
// the given name. // the given name.
static bool exists(const char* name) { return _all->contains(name); } static inline bool exists(const char* name);
// method to search for a instrumentation object by name // method to search for a instrumentation object by name
static PerfData* find_by_name(const char* name); static PerfData* find_by_name(const char* name);
@ -929,12 +930,7 @@ class PerfTraceTime : public StackObj {
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(); }
inline ~PerfTraceTime() { ~PerfTraceTime();
if (!UsePerfData || (_recursion_counter != NULL &&
--(*_recursion_counter) > 0)) return;
_t.stop();
_timerp->inc(_t.ticks());
}
}; };
/* The PerfTraceTimedEvent class is responsible for counting the /* The PerfTraceTimedEvent class is responsible for counting the

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2002, 2017, 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.
*
*/
#ifndef SHARE_VM_RUNTIME_PERFDATA_INLINE_HPP
#define SHARE_VM_RUNTIME_PERFDATA_INLINE_HPP
#include "runtime/perfData.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/growableArray.hpp"
inline int PerfDataList::length() {
return _set->length();
}
inline void PerfDataList::append(PerfData *p) {
_set->append(p);
}
inline void PerfDataList::remove(PerfData *p) {
_set->remove(p);
}
inline PerfData* PerfDataList::at(int index) {
return _set->at(index);
}
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) {
return _all->contains(name);
}
#endif // SHARE_VM_RUNTIME_PERFDATA_INLINE_HPP

View File

@ -32,6 +32,7 @@
#include "runtime/java.hpp" #include "runtime/java.hpp"
#include "runtime/javaCalls.hpp" #include "runtime/javaCalls.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "runtime/perfData.inline.hpp"
#include "runtime/statSampler.hpp" #include "runtime/statSampler.hpp"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"