Skip to content

Commit aee4d69

Browse files
committed
8348829: Remove ObjectMonitor perf counters
Reviewed-by: dholmes, coleenp
1 parent f9bcef4 commit aee4d69

File tree

4 files changed

+0
-116
lines changed

4 files changed

+0
-116
lines changed

src/hotspot/share/runtime/lightweightSynchronizer.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "runtime/mutexLocker.hpp"
4040
#include "runtime/objectMonitor.inline.hpp"
4141
#include "runtime/os.hpp"
42-
#include "runtime/perfData.inline.hpp"
4342
#include "runtime/safepointMechanism.inline.hpp"
4443
#include "runtime/safepointVerifiers.hpp"
4544
#include "runtime/synchronizer.inline.hpp"
@@ -388,9 +387,6 @@ ObjectMonitor* LightweightSynchronizer::get_or_insert_monitor(oop object, JavaTh
388387
ObjectMonitor* monitor = get_or_insert_monitor_from_table(object, current, &inserted);
389388

390389
if (inserted) {
391-
// Hopefully the performance counters are allocated on distinct
392-
// cache lines to avoid false sharing on MP systems ...
393-
OM_PERFDATA_OP(Inflations, inc());
394390
log_inflate(current, object, cause);
395391
if (event.should_commit()) {
396392
post_monitor_inflate_event(&event, object, cause);
@@ -878,9 +874,6 @@ ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, O
878874
// with the ObjectMonitor, it is safe to allow async deflation:
879875
ObjectSynchronizer::_in_use_list.add(monitor);
880876

881-
// Hopefully the performance counters are allocated on distinct
882-
// cache lines to avoid false sharing on MP systems ...
883-
OM_PERFDATA_OP(Inflations, inc());
884877
log_inflate(current, object, cause);
885878
if (event.should_commit()) {
886879
post_monitor_inflate_event(&event, object, cause);
@@ -919,9 +912,6 @@ ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, O
919912
// with the ObjectMonitor, it is safe to allow async deflation:
920913
ObjectSynchronizer::_in_use_list.add(m);
921914

922-
// Hopefully the performance counters are allocated on distinct
923-
// cache lines to avoid false sharing on MP systems ...
924-
OM_PERFDATA_OP(Inflations, inc());
925915
log_inflate(current, object, cause);
926916
if (event.should_commit()) {
927917
post_monitor_inflate_event(&event, object, cause);

src/hotspot/share/runtime/objectMonitor.cpp

-54
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#include "runtime/objectMonitor.inline.hpp"
5050
#include "runtime/orderAccess.hpp"
5151
#include "runtime/osThread.hpp"
52-
#include "runtime/perfData.hpp"
5352
#include "runtime/safefetch.hpp"
5453
#include "runtime/safepointMechanism.inline.hpp"
5554
#include "runtime/sharedRuntime.hpp"
@@ -648,8 +647,6 @@ void ObjectMonitor::enter_with_contention_mark(JavaThread* current, ObjectMonito
648647
current->post_vthread_pinned_event(&vthread_pinned_event, "Contended monitor enter", result);
649648
}
650649
}
651-
652-
OM_PERFDATA_OP(ContendedLockAttempts, inc());
653650
}
654651

655652
// Caveat: try_lock() is not necessarily serializing if it returns failure.
@@ -1025,14 +1022,6 @@ void ObjectMonitor::enter_internal(JavaThread* current) {
10251022

10261023
// The lock is still contested.
10271024

1028-
// Keep a tally of the # of futile wakeups.
1029-
// Note that the counter is not protected by a lock or updated by atomics.
1030-
// That is by design - we trade "lossy" counters which are exposed to
1031-
// races during updates for a lower probe effect.
1032-
// We are in safepoint safe state, so shutdown can remove the counter
1033-
// under our feet. Make sure we make this access safely.
1034-
OM_PERFDATA_SAFE_OP(FutileWakeups, inc());
1035-
10361025
// Assuming this is not a spurious wakeup we'll normally find _succ == current.
10371026
// We can defer clearing _succ until after the spin completes
10381027
// try_spin() must tolerate being called with _succ == current.
@@ -1145,12 +1134,6 @@ void ObjectMonitor::reenter_internal(JavaThread* current, ObjectWaiter* currentN
11451134
// Invariant: after clearing _succ a contending thread
11461135
// *must* retry _owner before parking.
11471136
OrderAccess::fence();
1148-
1149-
// Keep a tally of the # of futile wakeups.
1150-
// Note that the counter is not protected by a lock or updated by atomics.
1151-
// That is by design - we trade "lossy" counters which are exposed to
1152-
// races during updates for a lower probe effect.
1153-
OM_PERFDATA_OP(FutileWakeups, inc());
11541137
}
11551138

11561139
// Current has acquired the lock -- Unlink current from the _entry_list.
@@ -1608,9 +1591,6 @@ void ObjectMonitor::exit_epilog(JavaThread* current, ObjectWaiter* Wakee) {
16081591
// Virtual thread case.
16091592
Trigger->unpark();
16101593
}
1611-
1612-
// Maintain stats and report events to JVMTI
1613-
OM_PERFDATA_OP(Parks, inc());
16141594
}
16151595

16161596
// Exits the monitor returning recursion count. _owner should
@@ -2045,7 +2025,6 @@ void ObjectMonitor::notify(TRAPS) {
20452025
EventJavaMonitorNotify event;
20462026
DTRACE_MONITOR_PROBE(notify, this, object(), current);
20472027
int tally = notify_internal(current) ? 1 : 0;
2048-
OM_PERFDATA_OP(Notifications, inc(tally));
20492028

20502029
if ((tally > 0) && event.should_commit()) {
20512030
post_monitor_notify_event(&event, this, /* notified_count = */ tally);
@@ -2074,8 +2053,6 @@ void ObjectMonitor::notifyAll(TRAPS) {
20742053
}
20752054
}
20762055

2077-
OM_PERFDATA_OP(Notifications, inc(tally));
2078-
20792056
if ((tally > 0) && event.should_commit()) {
20802057
post_monitor_notify_event(&event, this, /* notified_count = */ tally);
20812058
}
@@ -2514,14 +2491,6 @@ inline void ObjectMonitor::dequeue_specific_waiter(ObjectWaiter* node) {
25142491
}
25152492

25162493
// -----------------------------------------------------------------------------
2517-
// PerfData support
2518-
PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts = nullptr;
2519-
PerfCounter * ObjectMonitor::_sync_FutileWakeups = nullptr;
2520-
PerfCounter * ObjectMonitor::_sync_Parks = nullptr;
2521-
PerfCounter * ObjectMonitor::_sync_Notifications = nullptr;
2522-
PerfCounter * ObjectMonitor::_sync_Inflations = nullptr;
2523-
PerfCounter * ObjectMonitor::_sync_Deflations = nullptr;
2524-
PerfLongVariable * ObjectMonitor::_sync_MonExtant = nullptr;
25252494

25262495
// One-shot global initialization for the sync subsystem.
25272496
// We could also defer initialization and initialize on-demand
@@ -2538,29 +2507,6 @@ void ObjectMonitor::Initialize() {
25382507
Knob_FixedSpin = -1;
25392508
}
25402509

2541-
if (UsePerfData) {
2542-
EXCEPTION_MARK;
2543-
#define NEWPERFCOUNTER(n) \
2544-
{ \
2545-
n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events, \
2546-
CHECK); \
2547-
}
2548-
#define NEWPERFVARIABLE(n) \
2549-
{ \
2550-
n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events, \
2551-
CHECK); \
2552-
}
2553-
NEWPERFCOUNTER(_sync_Inflations);
2554-
NEWPERFCOUNTER(_sync_Deflations);
2555-
NEWPERFCOUNTER(_sync_ContendedLockAttempts);
2556-
NEWPERFCOUNTER(_sync_FutileWakeups);
2557-
NEWPERFCOUNTER(_sync_Parks);
2558-
NEWPERFCOUNTER(_sync_Notifications);
2559-
NEWPERFVARIABLE(_sync_MonExtant);
2560-
#undef NEWPERFCOUNTER
2561-
#undef NEWPERFVARIABLE
2562-
}
2563-
25642510
_oop_storage = OopStorageSet::create_weak("ObjectSynchronizer Weak", mtSynchronizer);
25652511

25662512
DEBUG_ONLY(InitDone = true;)

src/hotspot/share/runtime/objectMonitor.hpp

-39
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "oops/oopHandle.hpp"
3232
#include "oops/weakHandle.hpp"
3333
#include "runtime/javaThread.hpp"
34-
#include "runtime/perfDataTypes.hpp"
3534
#include "utilities/checkedCast.hpp"
3635

3736
class ObjectMonitor;
@@ -218,44 +217,6 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {
218217
static OopHandle& vthread_list_head() { return _vthread_list_head; }
219218
static ParkEvent* vthread_unparker_ParkEvent() { return _vthread_unparker_ParkEvent; }
220219

221-
// Only perform a PerfData operation if the PerfData object has been
222-
// allocated and if the PerfDataManager has not freed the PerfData
223-
// objects which can happen at normal VM shutdown. This operation is
224-
// only safe when thread is not in safepoint-safe code, i.e. PerfDataManager
225-
// could not reach the safepoint and free the counter while we are using it.
226-
// If this is not guaranteed, use OM_PERFDATA_SAFE_OP instead.
227-
#define OM_PERFDATA_OP(f, op_str) \
228-
do { \
229-
if (ObjectMonitor::_sync_ ## f != nullptr) { \
230-
if (PerfDataManager::has_PerfData()) { \
231-
ObjectMonitor::_sync_ ## f->op_str; \
232-
} \
233-
} \
234-
} while (0)
235-
236-
// Only perform a PerfData operation if the PerfData object has been
237-
// allocated and if the PerfDataManager has not freed the PerfData
238-
// objects which can happen at normal VM shutdown. Additionally, we
239-
// enter the critical section to resolve the race against PerfDataManager
240-
// entering the safepoint and deleting the counter during shutdown.
241-
#define OM_PERFDATA_SAFE_OP(f, op_str) \
242-
do { \
243-
if (ObjectMonitor::_sync_ ## f != nullptr) { \
244-
GlobalCounter::CriticalSection cs(Thread::current()); \
245-
if (PerfDataManager::has_PerfData()) { \
246-
ObjectMonitor::_sync_ ## f->op_str; \
247-
} \
248-
} \
249-
} while (0)
250-
251-
static PerfCounter * _sync_ContendedLockAttempts;
252-
static PerfCounter * _sync_FutileWakeups;
253-
static PerfCounter * _sync_Parks;
254-
static PerfCounter * _sync_Notifications;
255-
static PerfCounter * _sync_Inflations;
256-
static PerfCounter * _sync_Deflations;
257-
static PerfLongVariable * _sync_MonExtant;
258-
259220
static int Knob_SpinLimit;
260221

261222
static ByteSize metadata_offset() { return byte_offset_of(ObjectMonitor, _metadata); }

src/hotspot/share/runtime/synchronizer.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#include "runtime/objectMonitor.inline.hpp"
4949
#include "runtime/os.inline.hpp"
5050
#include "runtime/osThread.hpp"
51-
#include "runtime/perfData.hpp"
5251
#include "runtime/safepointMechanism.inline.hpp"
5352
#include "runtime/safepointVerifiers.hpp"
5453
#include "runtime/sharedRuntime.hpp"
@@ -376,12 +375,9 @@ bool ObjectSynchronizer::quick_notify(oopDesc* obj, JavaThread* current, bool al
376375
} else {
377376
DTRACE_MONITOR_PROBE(notify, mon, obj, current);
378377
}
379-
int free_count = 0;
380378
do {
381379
mon->notify_internal(current);
382-
++free_count;
383380
} while (mon->first_waiter() != nullptr && all);
384-
OM_PERFDATA_OP(Notifications, inc(free_count));
385381
}
386382
return true;
387383
}
@@ -1595,9 +1591,6 @@ ObjectMonitor* ObjectSynchronizer::inflate_impl(JavaThread* locking_thread, oop
15951591
// with the ObjectMonitor, it is safe to allow async deflation:
15961592
_in_use_list.add(m);
15971593

1598-
// Hopefully the performance counters are allocated on distinct cache lines
1599-
// to avoid false sharing on MP systems ...
1600-
OM_PERFDATA_OP(Inflations, inc());
16011594
if (log_is_enabled(Trace, monitorinflation)) {
16021595
ResourceMark rm;
16031596
lsh.print_cr("inflate(has_locker): object=" INTPTR_FORMAT ", mark="
@@ -1637,9 +1630,6 @@ ObjectMonitor* ObjectSynchronizer::inflate_impl(JavaThread* locking_thread, oop
16371630
// with the ObjectMonitor, it is safe to allow async deflation:
16381631
_in_use_list.add(m);
16391632

1640-
// Hopefully the performance counters are allocated on distinct
1641-
// cache lines to avoid false sharing on MP systems ...
1642-
OM_PERFDATA_OP(Inflations, inc());
16431633
if (log_is_enabled(Trace, monitorinflation)) {
16441634
ResourceMark rm;
16451635
lsh.print_cr("inflate(unlocked): object=" INTPTR_FORMAT ", mark="
@@ -1867,9 +1857,6 @@ size_t ObjectSynchronizer::deflate_idle_monitors() {
18671857

18681858
log.end(deflated_count, unlinked_count);
18691859

1870-
OM_PERFDATA_OP(MonExtant, set_value(_in_use_list.count()));
1871-
OM_PERFDATA_OP(Deflations, inc(deflated_count));
1872-
18731860
GVars.stw_random = os::random();
18741861

18751862
if (deflated_count != 0) {

0 commit comments

Comments
 (0)