r941 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Thu Sep 7 09:27:21 CEST 2006


Author: phk
Date: 2006-09-07 09:27:21 +0200 (Thu, 07 Sep 2006)
New Revision: 941

Modified:
   trunk/varnish-cache/bin/varnishd/storage_file.c
   trunk/varnish-cache/include/stat_field.h
Log:
Add stats counters for large and small free fragments.

Remove debugging


Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2006-09-07 07:17:31 UTC (rev 940)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2006-09-07 07:27:21 UTC (rev 941)
@@ -301,8 +301,12 @@
 	assert(sp->alloc == 0);
 	assert(sp->flist == NULL);
 	b = sp->size / sc->pagesize;
-	if (b >= NBUCKET)
+	if (b >= NBUCKET) {
 		b = NBUCKET - 1;
+		VSL_stats->n_smf_large++;
+	} else {
+		VSL_stats->n_smf_frag++;
+	}
 	sp->flist = &sc->free[b];
 	n = 0;
 	TAILQ_FOREACH(sp2, sp->flist, status) {
@@ -316,7 +320,6 @@
 	}
 	if (sp2 == NULL)
 		TAILQ_INSERT_TAIL(sp->flist, sp, status);
-	VSL(SLT_Debug, 0, "FILE i %u %p %ju [%u]", b, sp, sp->size, n);
 }
 
 static void
@@ -327,12 +330,15 @@
 	assert(sp->alloc == 0);
 	assert(sp->flist != NULL);
 	b = sp->size / sc->pagesize;
-	if (b >= NBUCKET)
+	if (b >= NBUCKET) {
 		b = NBUCKET - 1;
+		VSL_stats->n_smf_large--;
+	} else {
+		VSL_stats->n_smf_frag--;
+	}
 	assert(sp->flist == &sc->free[b]);
 	TAILQ_REMOVE(sp->flist, sp, status);
 	sp->flist = NULL;
-	VSL(SLT_Debug, 0, "FILE r %u %p %ju", b, sp, sp->size);
 }
 
 /*--------------------------------------------------------------------
@@ -364,8 +370,6 @@
 	if (sp->size == bytes) {
 		sp->alloc = 1;
 		TAILQ_INSERT_TAIL(&sc->used, sp, status);
-		VSL(SLT_Debug, 0, "FILE A %p %ju == %ju [%d]",
-		    sp, (uintmax_t)sp->size, (uintmax_t)bytes, n);
 		return (sp);
 	}
 
@@ -374,8 +378,6 @@
 	XXXAN(sp2);
 	VSL_stats->n_smf++;
 	*sp2 = *sp;
-	VSL(SLT_Debug, 0, "FILE A %p %ju > %ju [%d] %p",
-	    sp, (uintmax_t)sp->size, (uintmax_t)bytes, n, sp2);
 
 	sp->offset += bytes;
 	sp->ptr += bytes;
@@ -405,14 +407,12 @@
 	assert(sp->alloc != 0);
 	sp->alloc = 0;
 
-	VSL(SLT_Debug, 0, "FILE F %p %ju", sp, sp->size);
 	sp2 = TAILQ_NEXT(sp, order);
 	if (sp2 != NULL &&
 	    sp2->alloc == 0 &&
 	    (sp2->ptr == sp->ptr + sp->size) &&
 	    (sp2->offset == sp->offset + sp->size)) {
 		sp->size += sp2->size;
-		VSL(SLT_Debug, 0, "FILE CN %p -> %p %ju", sp2, sp, sp->size);
 		TAILQ_REMOVE(&sc->order, sp2, order);
 		remfree(sc, sp2);
 		free(sp2);
@@ -426,7 +426,6 @@
 	    (sp->offset == sp2->offset + sp2->size)) {
 		remfree(sc, sp2);
 		sp2->size += sp->size;
-		VSL(SLT_Debug, 0, "FILE CP %p -> %p %ju", sp, sp2, sp2->size);
 		TAILQ_REMOVE(&sc->order, sp, order);
 		free(sp);
 		VSL_stats->n_smf--;
@@ -457,7 +456,6 @@
 	sp->size = bytes;
 	sp2->ptr += bytes;
 	sp2->offset += bytes;
-	VSL(SLT_Debug, 0, "FILE T %p -> %p %ju %d", sp, sp2, sp2->size);
 	TAILQ_INSERT_TAIL(&sc->used, sp2, status);
 	TAILQ_INSERT_AFTER(&sc->order, sp, sp2, order);
 	free_smf(sp2);

Modified: trunk/varnish-cache/include/stat_field.h
===================================================================
--- trunk/varnish-cache/include/stat_field.h	2006-09-07 07:17:31 UTC (rev 940)
+++ trunk/varnish-cache/include/stat_field.h	2006-09-07 07:27:21 UTC (rev 941)
@@ -18,6 +18,8 @@
 MAC_STAT(n_object,		uint64_t, "u", "N struct object")
 MAC_STAT(n_objecthead,		uint64_t, "u", "N struct objecthead")
 MAC_STAT(n_smf,			uint64_t, "u", "N struct smf")
+MAC_STAT(n_smf_frag,		uint64_t, "u", "N small free smf")
+MAC_STAT(n_smf_large,		uint64_t, "u", "N large free smf")
 MAC_STAT(n_vbe_conn,		uint64_t, "u", "N struct vbe_conn")
 MAC_STAT(n_wrk,			uint64_t, "u", "N worker threads")
 MAC_STAT(n_wrk_create,		uint64_t, "u", "N worker threads created")




More information about the varnish-commit mailing list