diff --git a/include/haproxy/thread-t.h b/include/haproxy/thread-t.h index d2bf8d365..33782f3c1 100644 --- a/include/haproxy/thread-t.h +++ b/include/haproxy/thread-t.h @@ -97,10 +97,13 @@ struct lock_stat { uint64_t nsec_wait_for_write; uint64_t nsec_wait_for_read; + uint64_t nsec_wait_for_seek; uint64_t num_write_locked; uint64_t num_write_unlocked; uint64_t num_read_locked; uint64_t num_read_unlocked; + uint64_t num_seek_locked; + uint64_t num_seek_unlocked; }; struct ha_spinlock { @@ -123,6 +126,8 @@ struct ha_rwlock { unsigned long wait_writers; /* a bit is set to 1 << tid for waiting writers */ unsigned long cur_readers; /* a bit is set to 1 << tid for current readers */ unsigned long wait_readers; /* a bit is set to 1 << tid for waiting waiters */ + unsigned long cur_seeker; /* a bit is set to 1 << tid for the lock seekers */ + unsigned long wait_seekers; /* a bit is set to 1 << tid for waiting seekers */ struct { const char *function; const char *file; diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index a9a4b62a5..a3451bde5 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -422,16 +422,26 @@ static inline void show_lock_stats() "\t # write unlock: %lu (%ld)\n" "\t # wait time for write : %.3f msec\n" "\t # wait time for write/lock: %.3f nsec\n" + "\t # seek lock : %lu\n" + "\t # seek unlock : %lu (%ld)\n" + "\t # wait time for seek : %.3f msec\n" + "\t # wait time for seek/lock : %.3f nsec\n" "\t # read lock : %lu\n" "\t # read unlock : %lu (%ld)\n" "\t # wait time for read : %.3f msec\n" "\t # wait time for read/lock : %.3f nsec\n", + lock_label(lbl), lock_stats[lbl].num_write_locked, lock_stats[lbl].num_write_unlocked, lock_stats[lbl].num_write_unlocked - lock_stats[lbl].num_write_locked, (double)lock_stats[lbl].nsec_wait_for_write / 1000000.0, lock_stats[lbl].num_write_locked ? ((double)lock_stats[lbl].nsec_wait_for_write / (double)lock_stats[lbl].num_write_locked) : 0, + lock_stats[lbl].num_seek_locked, + lock_stats[lbl].num_seek_unlocked, + lock_stats[lbl].num_seek_unlocked - lock_stats[lbl].num_seek_locked, + (double)lock_stats[lbl].nsec_wait_for_seek / 1000000.0, + lock_stats[lbl].num_seek_locked ? ((double)lock_stats[lbl].nsec_wait_for_seek / (double)lock_stats[lbl].num_seek_locked) : 0, lock_stats[lbl].num_read_locked, lock_stats[lbl].num_read_unlocked, lock_stats[lbl].num_read_unlocked - lock_stats[lbl].num_read_locked,