summaryrefslogtreecommitdiff
path: root/src/include/mutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/mutex.h')
-rw-r--r--src/include/mutex.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/include/mutex.h b/src/include/mutex.h
index f0f8173bad4..b736d6ee9fb 100644
--- a/src/include/mutex.h
+++ b/src/include/mutex.h
@@ -74,6 +74,16 @@ struct __wt_rwlock {
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
volatile int lock;
+
+ /*
+ * We track acquisitions and time spent waiting for some locks. For
+ * performance reasons and to make it possible to write generic code
+ * that tracks statistics for different locks, we store the offset
+ * of the statistics fields to be updated during lock acquisition.
+ */
+ int16_t stat_count_off; /* acquisitions offset */
+ int16_t stat_app_usecs_off; /* waiting application threads offset */
+ int16_t stat_int_usecs_off; /* waiting server threads offset */
};
#elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX ||\
@@ -83,7 +93,17 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_spinlock {
wt_mutex_t lock;
- const char *name; /* Statistics: mutex name */
+ const char *name; /* Mutex name */
+
+ /*
+ * We track acquisitions and time spent waiting for some locks. For
+ * performance reasons and to make it possible to write generic code
+ * that tracks statistics for different locks, we store the offset
+ * of the statistics fields to be updated during lock acquisition.
+ */
+ int16_t stat_count_off; /* acquisitions offset */
+ int16_t stat_app_usecs_off; /* waiting application threads offset */
+ int16_t stat_int_usecs_off; /* waiting server threads offset */
int8_t initialized; /* Lock initialized, for cleanup */
};