From: Willy Tarreau Date: Wed, 17 Feb 2021 13:33:58 +0000 (+0100) Subject: DEBUG: thread: add 5 extra lock labels for statistics and debugging X-Git-Tag: v2.4-dev9~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccea3c54f4b39774ccb48cfd604a22acb8e59c86;p=thirdparty%2Fhaproxy.git DEBUG: thread: add 5 extra lock labels for statistics and debugging Since OTHER_LOCK is commonly used it's become much more difficult to profile lock contention by temporarily changing a lock label. Let's add DEBUG1..5 to serve only for debugging. These ones must not be used in committed code. We could decide to only define them when DEBUG_THREAD is set but that would complicate attempts at measuring performance with debugging turned off. --- diff --git a/include/haproxy/thread.h b/include/haproxy/thread.h index a519e77bb9..4419c2c787 100644 --- a/include/haproxy/thread.h +++ b/include/haproxy/thread.h @@ -402,6 +402,14 @@ enum lock_label { SFT_LOCK, /* sink forward target */ IDLE_CONNS_LOCK, OTHER_LOCK, + /* WT: make sure never to use these ones outside of development, + * we need them for lock profiling! + */ + DEBUG1_LOCK, + DEBUG2_LOCK, + DEBUG3_LOCK, + DEBUG4_LOCK, + DEBUG5_LOCK, LOCK_LABELS }; @@ -447,6 +455,11 @@ static inline const char *lock_label(enum lock_label label) case SFT_LOCK: return "SFT"; case IDLE_CONNS_LOCK: return "IDLE_CONNS"; case OTHER_LOCK: return "OTHER"; + case DEBUG1_LOCK: return "DEBUG1"; + case DEBUG2_LOCK: return "DEBUG2"; + case DEBUG3_LOCK: return "DEBUG3"; + case DEBUG4_LOCK: return "DEBUG4"; + case DEBUG5_LOCK: return "DEBUG5"; case LOCK_LABELS: break; /* keep compiler happy */ }; /* only way to come here is consecutive to an internal bug */