summaryrefslogtreecommitdiff
path: root/vm_sync.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-16 10:10:05 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-16 10:38:12 +0900
commit0b678cc9e5a5149e40765562142ed1dc05d09b53 (patch)
treea2dc78ae64a8323acecd43ee044cc1e5ed8786e1 /vm_sync.h
parent171f0431e766ba5b1a326386fff34a30f6cbc4c5 (diff)
add vm_sync debug counters
* vm_sync_lock * vm_sync_lock_enter * vm_sync_lock_enter_nb * vm_sync_lock_enter_cr * vm_sync_barrier
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3910
Diffstat (limited to 'vm_sync.h')
-rw-r--r--vm_sync.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/vm_sync.h b/vm_sync.h
index 8712e1a1ca..b8ebb3bbc5 100644
--- a/vm_sync.h
+++ b/vm_sync.h
@@ -3,6 +3,7 @@
#define RUBY_VM_SYNC_H
#include "vm_debug.h"
+#include "debug_counter.h"
#if USE_RUBY_DEBUG_LOG
#define LOCATION_ARGS const char *file, int line
@@ -51,6 +52,8 @@ rb_multi_ractor_p(void)
static inline void
rb_vm_lock(const char *file, int line)
{
+ RB_DEBUG_COUNTER_INC(vm_sync_lock);
+
if (rb_multi_ractor_p()) {
rb_vm_lock_body(LOCATION_PARAMS);
}
@@ -67,6 +70,8 @@ rb_vm_unlock(const char *file, int line)
static inline void
rb_vm_lock_enter(unsigned int *lev, const char *file, int line)
{
+ RB_DEBUG_COUNTER_INC(vm_sync_lock_enter);
+
if (rb_multi_ractor_p()) {
rb_vm_lock_enter_body(lev APPEND_LOCATION_PARAMS);
}
@@ -75,6 +80,8 @@ rb_vm_lock_enter(unsigned int *lev, const char *file, int line)
static inline void
rb_vm_lock_enter_nb(unsigned int *lev, const char *file, int line)
{
+ RB_DEBUG_COUNTER_INC(vm_sync_lock_enter_nb);
+
if (rb_multi_ractor_p()) {
rb_vm_lock_enter_body_nb(lev APPEND_LOCATION_PARAMS);
}
@@ -91,6 +98,7 @@ rb_vm_lock_leave(unsigned int *lev, const char *file, int line)
static inline void
rb_vm_lock_enter_cr(struct rb_ractor_struct *cr, unsigned int *levp, const char *file, int line)
{
+ RB_DEBUG_COUNTER_INC(vm_sync_lock_enter_cr);
rb_vm_lock_enter_body_cr(cr, levp APPEND_LOCATION_PARAMS);
}