]> err.no Git - varnish/commitdiff
Keep track of shmlog mutex contests
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 17 Sep 2006 19:30:31 +0000 (19:30 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 17 Sep 2006 19:30:31 +0000 (19:30 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1051 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/shmlog.c
varnish-cache/include/Makefile.am
varnish-cache/include/stat_field.h

index 73c5d50f7c2c68b385154ca2953f50ae66874a3c..ee6c4dca6e3464cdf94bfffbf2bbbfe5b527a480 100644 (file)
@@ -422,9 +422,6 @@ cli_func_t  cli_func_dump_pool;
 /* rfc2616.c */
 int RFC2616_cache_policy(struct sess *sp, struct http *hp);
 
-#define LOCKSHM(foo)   AZ(pthread_mutex_lock(foo))
-#define UNLOCKSHM(foo) AZ(pthread_mutex_unlock(foo))
-
 #if 1
 #define MTX                    pthread_mutex_t
 #define MTX_INIT(foo)          AZ(pthread_mutex_init(foo, NULL))
index 892a0ce1f87f9118e2a715dc7467b8036740812e..70558d81b4094eb4a3771e1536c22442ff07c5e9 100644 (file)
 
 #include "heritage.h"
 
+#define LOCKSHM(foo)                                   \
+       do {                                            \
+               if (pthread_mutex_trylock(foo)) {       \
+                       AZ(pthread_mutex_lock(foo));    \
+                       VSL_stats->shm_cont++;          \
+               }                                       \
+       } while (0);
+               
+#define UNLOCKSHM(foo) AZ(pthread_mutex_unlock(foo))
+
 #ifndef MAP_HASSEMAPHORE
 #define MAP_HASSEMAPHORE 0 /* XXX Linux */
 #endif
index 254710af820dd32127831eaef0767129c6759f2c..c5bedcb2502b90f2cf1f989d8af316f1bf2c90c1 100644 (file)
@@ -24,7 +24,6 @@ noinst_HEADERS = \
        shmlog_tags.h \
        stat_field.h \
        stats.h \
-       tree.h \
        varnish/assert.h \
        varnishapi.h \
        vcl.h \
index acbf9f77fa9943be4e341c6d1cf54e0f3bf7bd02..f85ec9969d28c6fa2514edda52f39cce167ab7ed 100644 (file)
@@ -48,3 +48,5 @@ MAC_STAT(sess_closed,         uint64_t, "u", "Session Closed")
 MAC_STAT(sess_pipeline,                uint64_t, "u", "Session Pipeline")
 MAC_STAT(sess_readahead,       uint64_t, "u", "Session Read Ahead")
 MAC_STAT(sess_herd,            uint64_t, "u", "Session herd")
+
+MAC_STAT(shm_cont,             uint64_t, "u", "SHM MTX contention")