8191860: Add perfData.inline.hpp
Reviewed-by: ehelin, pliden
This commit is contained in:
parent
5fd6905c94
commit
dbc915dcb9
@ -26,6 +26,7 @@
|
||||
#define SHARE_VM_CLASSFILE_CLASSLOADER_HPP
|
||||
|
||||
#include "jimage.hpp"
|
||||
#include "runtime/handles.hpp"
|
||||
#include "runtime/orderAccess.hpp"
|
||||
#include "runtime/perfData.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
@ -42,6 +43,7 @@
|
||||
class JImageFile;
|
||||
class ClassFileStream;
|
||||
class PackageEntry;
|
||||
template <typename T> class GrowableArray;
|
||||
|
||||
class ClassPathEntry : public CHeapObj<mtClass> {
|
||||
private:
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/collectorCounters.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
|
||||
CollectorCounters::CollectorCounters(const char* name, int ordinal) {
|
||||
|
||||
@ -59,3 +60,24 @@ CollectorCounters::CollectorCounters(const char* name, int ordinal) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,7 @@ class CollectorCounters: public CHeapObj<mtGC> {
|
||||
|
||||
CollectorCounters(const char* name, int ordinal);
|
||||
|
||||
~CollectorCounters() {
|
||||
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
|
||||
}
|
||||
~CollectorCounters();
|
||||
|
||||
inline PerfCounter* invocation_counter() const { return _invocations; }
|
||||
|
||||
@ -70,18 +68,9 @@ class TraceCollectorStats: public PerfTraceTimedEvent {
|
||||
CollectorCounters* _c;
|
||||
|
||||
public:
|
||||
inline TraceCollectorStats(CollectorCounters* c) :
|
||||
PerfTraceTimedEvent(c->time_counter(), c->invocation_counter()),
|
||||
_c(c) {
|
||||
TraceCollectorStats(CollectorCounters* c);
|
||||
|
||||
if (UsePerfData) {
|
||||
_c->last_entry_counter()->set_value(os::elapsed_counter());
|
||||
}
|
||||
}
|
||||
|
||||
inline ~TraceCollectorStats() {
|
||||
if (UsePerfData) _c->last_exit_counter()->set_value(os::elapsed_counter());
|
||||
}
|
||||
~TraceCollectorStats();
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_GC_SHARED_COLLECTORCOUNTERS_HPP
|
||||
|
@ -78,6 +78,12 @@ GenerationCounters::GenerationCounters(const char* name,
|
||||
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() {
|
||||
assert(_virtual_space != NULL, "otherwise, override this method");
|
||||
_current_size->set_value(_virtual_space->committed_size());
|
||||
|
@ -68,9 +68,7 @@ private:
|
||||
GenerationCounters(const char* name, int ordinal, int spaces,
|
||||
size_t min_capacity, size_t max_capacity, VirtualSpace* v);
|
||||
|
||||
~GenerationCounters() {
|
||||
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
|
||||
}
|
||||
~GenerationCounters();
|
||||
|
||||
virtual void update_all();
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/interfaceSupport.hpp"
|
||||
#include "runtime/perfData.hpp"
|
||||
#include "runtime/perfData.inline.hpp"
|
||||
#include "runtime/perfMemory.hpp"
|
||||
|
||||
/*
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "logging/logLevel.hpp"
|
||||
#include "logging/logTag.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/perfData.hpp"
|
||||
|
@ -25,6 +25,7 @@
|
||||
#ifndef SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
|
||||
#define SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
|
||||
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/park.hpp"
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/perfData.hpp"
|
||||
#include "runtime/perfData.inline.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
@ -611,3 +611,10 @@ PerfDataList* PerfDataList::clone() {
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
PerfTraceTime::~PerfTraceTime() {
|
||||
if (!UsePerfData || (_recursion_counter != NULL &&
|
||||
--(*_recursion_counter) > 0)) return;
|
||||
_t.stop();
|
||||
_timerp->inc(_t.ticks());
|
||||
}
|
||||
|
@ -25,10 +25,11 @@
|
||||
#ifndef 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/timer.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
|
||||
template <typename T> class GrowableArray;
|
||||
|
||||
/* jvmstat global and subsystem counter name space - enumeration value
|
||||
* 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; }
|
||||
|
||||
// return the number of PerfData items in this list
|
||||
int length() { return _set->length(); }
|
||||
inline int length();
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// index greater than the index of the element removed by this
|
||||
// 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
|
||||
// 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
|
||||
// some form of iterator to provide a cleaner abstraction for
|
||||
// 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:
|
||||
// return the list of all known PerfData items
|
||||
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
|
||||
// sampled by the StatSampler.
|
||||
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
|
||||
// variability classification of type Constant
|
||||
static PerfDataList* constants();
|
||||
static int constants_count() { return _constants->length(); }
|
||||
static inline int constants_count();
|
||||
|
||||
public:
|
||||
|
||||
// method to check for the existence of a PerfData item with
|
||||
// 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
|
||||
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 resume() { if (!UsePerfData) return; _t.start(); }
|
||||
|
||||
inline ~PerfTraceTime() {
|
||||
if (!UsePerfData || (_recursion_counter != NULL &&
|
||||
--(*_recursion_counter) > 0)) return;
|
||||
_t.stop();
|
||||
_timerp->inc(_t.ticks());
|
||||
}
|
||||
~PerfTraceTime();
|
||||
};
|
||||
|
||||
/* The PerfTraceTimedEvent class is responsible for counting the
|
||||
|
64
src/hotspot/share/runtime/perfData.inline.hpp
Normal file
64
src/hotspot/share/runtime/perfData.inline.hpp
Normal 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
|
@ -32,6 +32,7 @@
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/perfData.inline.hpp"
|
||||
#include "runtime/statSampler.hpp"
|
||||
#include "runtime/vm_version.hpp"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user