[master] a187a0a Elimiante diag_bitmaps and the mutex-profiling/measuring code.
Poul-Henning Kamp
phk at varnish-cache.org
Tue Aug 28 11:06:32 CEST 2012
commit a187a0ad4f7552a65684649ffddd745c14c1c791
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Aug 28 09:06:00 2012 +0000
Elimiante diag_bitmaps and the mutex-profiling/measuring code.
XXX: doc-change needed.
diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 993bb5e..bd34046 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -37,7 +37,6 @@
#include <stdlib.h>
-#include "vtim.h"
#include "cache.h"
/*The constability of lck depends on platform pthreads implementation */
@@ -48,7 +47,6 @@ struct ilck {
pthread_mutex_t mtx;
int held;
pthread_t owner;
- double t0;
VTAILQ_ENTRY(ilck) list;
const char *w;
struct VSC_C_lck *stat;
@@ -63,37 +61,13 @@ void __match_proto__()
Lck__Lock(struct lock *lck, const char *p, const char *f, int l)
{
struct ilck *ilck;
- int r;
- double t0 = 0, t;
+
+ (void)p;
+ (void)f;
+ (void)l;
CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC);
- if (!(cache_param->diag_bitmap & 0x98)) {
- AZ(pthread_mutex_lock(&ilck->mtx));
- AZ(ilck->held);
- ilck->stat->locks++;
- ilck->owner = pthread_self();
- ilck->held = 1;
- return;
- }
- if (cache_param->diag_bitmap & 0x80)
- t0 = VTIM_real();
- r = pthread_mutex_trylock(&ilck->mtx);
- assert(r == 0 || r == EBUSY);
- if (r) {
- ilck->stat->colls++;
- if (cache_param->diag_bitmap & 0x8)
- VSL(SLT_Debug, 0, "MTX_CONTEST(%s,%s,%d,%s)",
- p, f, l, ilck->w);
- AZ(pthread_mutex_lock(&ilck->mtx));
- } else if (cache_param->diag_bitmap & 0x8) {
- VSL(SLT_Debug, 0, "MTX_LOCK(%s,%s,%d,%s)", p, f, l, ilck->w);
- }
- if (cache_param->diag_bitmap & 0x80) {
- t = VTIM_real();
- VSL(SLT_Debug, 0, "MTX_LOCKWAIT(%s,%s,%d,%s) %.9fs",
- p, f, l, ilck->w, t - t0);
- ilck->t0 = t;
- }
+ AZ(pthread_mutex_lock(&ilck->mtx));
AZ(ilck->held);
ilck->stat->locks++;
ilck->owner = pthread_self();
@@ -105,6 +79,10 @@ Lck__Unlock(struct lock *lck, const char *p, const char *f, int l)
{
struct ilck *ilck;
+ (void)p;
+ (void)f;
+ (void)l;
+
CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC);
assert(pthread_equal(ilck->owner, pthread_self()));
AN(ilck->held);
@@ -121,11 +99,6 @@ Lck__Unlock(struct lock *lck, const char *p, const char *f, int l)
*/
memset(&ilck->owner, 0, sizeof ilck->owner);
AZ(pthread_mutex_unlock(&ilck->mtx));
- if (cache_param->diag_bitmap & 0x80)
- VSL(SLT_Debug, 0, "MTX_UNLOCK(%s,%s,%d,%s) %.9fs",
- p, f, l, ilck->w, VTIM_real() - ilck->t0);
- else if (cache_param->diag_bitmap & 0x8)
- VSL(SLT_Debug, 0, "MTX_UNLOCK(%s,%s,%d,%s)", p, f, l, ilck->w);
}
int __match_proto__()
@@ -134,19 +107,18 @@ Lck__Trylock(struct lock *lck, const char *p, const char *f, int l)
struct ilck *ilck;
int r;
+ (void)p;
+ (void)f;
+ (void)l;
+
CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC);
r = pthread_mutex_trylock(&ilck->mtx);
assert(r == 0 || r == EBUSY);
- if (cache_param->diag_bitmap & 0x8)
- VSL(SLT_Debug, 0,
- "MTX_TRYLOCK(%s,%s,%d,%s) = %d", p, f, l, ilck->w, r);
if (r == 0) {
AZ(ilck->held);
ilck->held = 1;
ilck->stat->locks++;
ilck->owner = pthread_self();
- if (cache_param->diag_bitmap & 0x80)
- ilck->t0 = VTIM_real();
}
return (r);
}
diff --git a/bin/varnishd/common/params.h b/bin/varnishd/common/params.h
index 6abe0fc..7c1ccd5 100644
--- a/bin/varnishd/common/params.h
+++ b/bin/varnishd/common/params.h
@@ -155,9 +155,6 @@ struct params {
/* CLI buffer size */
unsigned cli_buffer;
- /* Control diagnostic code */
- unsigned diag_bitmap;
-
/* Log local socket address to shm */
unsigned log_local_addr;
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 434082e..b0631a3 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -579,22 +579,6 @@ tweak_waiter(struct cli *cli, const struct parspec *par, const char *arg)
/*--------------------------------------------------------------------*/
static void
-tweak_diag_bitmap(struct cli *cli, const struct parspec *par, const char *arg)
-{
- unsigned u;
-
- (void)par;
- if (arg != NULL) {
- u = strtoul(arg, NULL, 0);
- mgt_param.diag_bitmap = u;
- } else {
- VCLI_Out(cli, "0x%x", mgt_param.diag_bitmap);
- }
-}
-
-/*--------------------------------------------------------------------*/
-
-static void
tweak_poolparam(struct cli *cli, const struct parspec *par, const char *arg)
{
volatile struct poolparam *pp, px;
@@ -1044,19 +1028,6 @@ static const struct parspec input_parspec[] = {
"Select the waiter kernel interface.\n",
WIZARD | MUST_RESTART,
WAITER_DEFAULT, NULL },
- { "diag_bitmap", tweak_diag_bitmap, 0, 0, 0,
- "Bitmap controlling diagnostics code:\n"
- " 0x00000008 - mutex logging.\n"
- " 0x00000010 - mutex contests.\n"
- " 0x00000080 - mutex timing.\n"
- "\n"
- "Use 0x notation and do the bitor in your head :-)\n"
- "\n"
- "Note: Mutex timing will add extra overhead and "
- "synchronization between threads, consequently changing the "
- "locking characteristics.\n",
- 0,
- "0", "bitmap" },
{ "ban_dups", tweak_bool, &mgt_param.ban_dups, 0, 0,
"Detect and eliminate duplicate bans.\n",
0,
diff --git a/bin/varnishtest/tests/b00008.vtc b/bin/varnishtest/tests/b00008.vtc
index b8dcbc8..1ce9b64 100644
--- a/bin/varnishtest/tests/b00008.vtc
+++ b/bin/varnishtest/tests/b00008.vtc
@@ -20,12 +20,6 @@ varnish v1 -clierr 105 "help 1 2 3"
varnish v1 -cliok "param.show"
-varnish v1 -cliok "param.show diag_bitmap"
-
-varnish v1 -cliok "param.set diag_bitmap 0x80"
-
-varnish v1 -cliok "param.set diag_bitmap 0x0"
-
varnish v1 -start
varnish v1 -cliok "help"
More information about the varnish-commit
mailing list