Skip to content

Commit 6ebae6c

Browse files
caspernorrbinalbertnetymk
authored andcommitted
8241678: Remove PerfData sampling via StatSampler
Reviewed-by: jsjolen, ayang
1 parent f30e154 commit 6ebae6c

File tree

25 files changed

+209
-714
lines changed

25 files changed

+209
-714
lines changed

src/hotspot/os/aix/os_aix.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
#include "runtime/perfMemory.hpp"
5959
#include "runtime/safefetch.hpp"
6060
#include "runtime/sharedRuntime.hpp"
61-
#include "runtime/statSampler.hpp"
6261
#include "runtime/threads.hpp"
6362
#include "runtime/timer.hpp"
6463
#include "runtime/vm_version.hpp"

src/hotspot/os/bsd/os_bsd.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#include "runtime/perfMemory.hpp"
5454
#include "runtime/semaphore.hpp"
5555
#include "runtime/sharedRuntime.hpp"
56-
#include "runtime/statSampler.hpp"
5756
#include "runtime/stubRoutines.hpp"
5857
#include "runtime/threads.hpp"
5958
#include "runtime/timer.hpp"

src/hotspot/os/linux/os_linux.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include "runtime/osThread.hpp"
5757
#include "runtime/perfMemory.hpp"
5858
#include "runtime/sharedRuntime.hpp"
59-
#include "runtime/statSampler.hpp"
6059
#include "runtime/stubRoutines.hpp"
6160
#include "runtime/threads.hpp"
6261
#include "runtime/threadSMR.hpp"

src/hotspot/os/windows/os_windows.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
#include "runtime/safepointMechanism.hpp"
6161
#include "runtime/semaphore.inline.hpp"
6262
#include "runtime/sharedRuntime.hpp"
63-
#include "runtime/statSampler.hpp"
6463
#include "runtime/stubRoutines.hpp"
6564
#include "runtime/suspendedThreadTask.hpp"
6665
#include "runtime/threads.hpp"

src/hotspot/share/gc/parallel/spaceCounters.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333

3434
SpaceCounters::SpaceCounters(const char* name, int ordinal, size_t max_size,
3535
MutableSpace* m, GenerationCounters* gc)
36-
: _last_used_in_bytes(0), _object_space(m)
37-
{
36+
: _object_space(m) {
3837
if (UsePerfData) {
3938
EXCEPTION_MARK;
4039
ResourceMark rm;
@@ -60,7 +59,7 @@ SpaceCounters::SpaceCounters(const char* name, int ordinal, size_t max_size,
6059

6160
cname = PerfDataManager::counter_name(_name_space, "used");
6261
_used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
63-
new UsedHelper(this),
62+
_object_space->used_in_bytes(),
6463
CHECK);
6564

6665
cname = PerfDataManager::counter_name(_name_space, "initCapacity");
@@ -74,21 +73,5 @@ SpaceCounters::~SpaceCounters() {
7473
}
7574

7675
void SpaceCounters::update_used() {
77-
size_t new_used = _object_space->used_in_bytes();
78-
Atomic::store(&_last_used_in_bytes, new_used);
79-
_used->set_value(new_used);
80-
}
81-
82-
jlong SpaceCounters::UsedHelper::take_sample() {
83-
// Sampling may occur during GC, possibly while GC is updating the space.
84-
// The space can be in an inconsistent state during such an update. We
85-
// don't want to block sampling for the duration of a GC. Instead, skip
86-
// sampling in that case, using the last recorded value.
87-
assert(!Heap_lock->owned_by_self(), "precondition");
88-
if (Heap_lock->try_lock()) {
89-
size_t new_used = _counters->_object_space->used_in_bytes();
90-
Atomic::store(&_counters->_last_used_in_bytes, new_used);
91-
Heap_lock->unlock();
92-
}
93-
return Atomic::load(&_counters->_last_used_in_bytes);
76+
_used->set_value(_object_space->used_in_bytes());
9477
}

src/hotspot/share/gc/parallel/spaceCounters.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class SpaceCounters: public CHeapObj<mtGC> {
3939
private:
4040
PerfVariable* _capacity;
4141
PerfVariable* _used;
42-
volatile size_t _last_used_in_bytes;
4342

4443
// Constant PerfData types don't need to retain a reference.
4544
// However, it's a good idea to document them here.
@@ -48,8 +47,6 @@ class SpaceCounters: public CHeapObj<mtGC> {
4847
MutableSpace* _object_space;
4948
char* _name_space;
5049

51-
class UsedHelper;
52-
5350
public:
5451

5552
SpaceCounters(const char* name, int ordinal, size_t max_size,
@@ -71,14 +68,4 @@ class SpaceCounters: public CHeapObj<mtGC> {
7168
const char* name_space() const { return _name_space; }
7269
};
7370

74-
class SpaceCounters::UsedHelper: public PerfLongSampleHelper {
75-
private:
76-
SpaceCounters* _counters;
77-
78-
public:
79-
UsedHelper(SpaceCounters* counters) : _counters(counters) { }
80-
81-
jlong take_sample() override;
82-
};
83-
8471
#endif // SHARE_GC_PARALLEL_SPACECOUNTERS_HPP

src/hotspot/share/gc/serial/cSpaceCounters.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828

2929
CSpaceCounters::CSpaceCounters(const char* name, int ordinal, size_t max_size,
3030
ContiguousSpace* s, GenerationCounters* gc)
31-
: _last_used_in_bytes(0), _space(s)
32-
{
31+
: _space(s) {
3332
if (UsePerfData) {
3433
EXCEPTION_MARK;
3534
ResourceMark rm;
@@ -57,7 +56,7 @@ CSpaceCounters::CSpaceCounters(const char* name, int ordinal, size_t max_size,
5756

5857
cname = PerfDataManager::counter_name(_name_space, "used");
5958
_used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
60-
new UsedHelper(this),
59+
_space->used(),
6160
CHECK);
6261

6362
cname = PerfDataManager::counter_name(_name_space, "initCapacity");
@@ -75,26 +74,10 @@ void CSpaceCounters::update_capacity() {
7574
}
7675

7776
void CSpaceCounters::update_used() {
78-
size_t new_used = _space->used();
79-
Atomic::store(&_last_used_in_bytes, new_used);
80-
_used->set_value(new_used);
77+
_used->set_value(_space->used());
8178
}
8279

8380
void CSpaceCounters::update_all() {
8481
update_used();
8582
update_capacity();
8683
}
87-
88-
jlong CSpaceCounters::UsedHelper::take_sample(){
89-
// Sampling may occur during GC, possibly while GC is updating the space.
90-
// The space can be in an inconsistent state during such an update. We
91-
// don't want to block sampling for the duration of a GC. Instead, skip
92-
// sampling in that case, using the last recorded value.
93-
assert(!Heap_lock->owned_by_self(), "precondition");
94-
if (Heap_lock->try_lock()) {
95-
size_t new_used = _counters->_space->used();
96-
Atomic::store(&_counters->_last_used_in_bytes, new_used);
97-
Heap_lock->unlock();
98-
}
99-
return Atomic::load(&_counters->_last_used_in_bytes);
100-
}

src/hotspot/share/gc/serial/cSpaceCounters.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class CSpaceCounters: public CHeapObj<mtGC> {
3939
PerfVariable* _capacity;
4040
PerfVariable* _used;
4141
PerfVariable* _max_capacity;
42-
volatile size_t _last_used_in_bytes;
4342

4443
// Constant PerfData types don't need to retain a reference.
4544
// However, it's a good idea to document them here.
@@ -48,8 +47,6 @@ class CSpaceCounters: public CHeapObj<mtGC> {
4847
ContiguousSpace* _space;
4948
char* _name_space;
5049

51-
class UsedHelper;
52-
5350
public:
5451

5552
CSpaceCounters(const char* name, int ordinal, size_t max_size,
@@ -64,14 +61,4 @@ class CSpaceCounters: public CHeapObj<mtGC> {
6461
const char* name_space() const { return _name_space; }
6562
};
6663

67-
class CSpaceCounters::UsedHelper : public PerfLongSampleHelper {
68-
private:
69-
CSpaceCounters* _counters;
70-
71-
public:
72-
UsedHelper(CSpaceCounters* counters) : _counters(counters) { }
73-
74-
jlong take_sample() override;
75-
};
76-
7764
#endif // SHARE_GC_SERIAL_CSPACECOUNTERS_HPP

src/hotspot/share/runtime/arguments.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ static SpecialFlag const special_jvm_flags[] = {
536536

537537
// -------------- Obsolete Flags - sorted by expired_in --------------
538538

539+
{ "PerfDataSamplingInterval", JDK_Version::undefined(), JDK_Version::jdk(25), JDK_Version::jdk(26) },
539540
{ "MetaspaceReclaimPolicy", JDK_Version::undefined(), JDK_Version::jdk(21), JDK_Version::undefined() },
540541
{ "ZGenerational", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::undefined() },
541542
{ "ZMarkStackSpaceLimit", JDK_Version::undefined(), JDK_Version::jdk(25), JDK_Version::undefined() },

src/hotspot/share/runtime/globals.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,11 +1728,6 @@ const int ObjectAlignmentInBytes = 8;
17281728
"The string %p in the file name (if present) " \
17291729
"will be replaced by pid") \
17301730
\
1731-
product(int, PerfDataSamplingInterval, 50, \
1732-
"Data sampling interval (in milliseconds)") \
1733-
range(PeriodicTask::min_interval, max_jint) \
1734-
constraint(PerfDataSamplingIntervalFunc, AfterErgo) \
1735-
\
17361731
product(bool, PerfDisableSharedMem, false, \
17371732
"Store performance data in standard memory") \
17381733
\

0 commit comments

Comments
 (0)