r5658 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Mon Dec 20 11:12:42 CET 2010


Author: phk
Date: 2010-12-20 11:12:42 +0100 (Mon, 20 Dec 2010)
New Revision: 5658

Modified:
   trunk/varnish-cache/bin/varnishd/storage_malloc.c
Log:
Implment the free_space and used_space variables for -smalloc



Modified: trunk/varnish-cache/bin/varnishd/storage_malloc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_malloc.c	2010-12-20 10:00:55 UTC (rev 5657)
+++ trunk/varnish-cache/bin/varnishd/storage_malloc.c	2010-12-20 10:12:42 UTC (rev 5658)
@@ -147,6 +147,24 @@
 	}
 }
 
+static double
+sma_used_space(const struct stevedore *st)
+{
+	struct sma_sc *sma_sc;
+
+	CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC);
+	return (sma_sc->stats->nbytes);
+}
+
+static double
+sma_free_space(const struct stevedore *st)
+{
+	struct sma_sc *sma_sc;
+
+	CAST_OBJ_NOTNULL(sma_sc, st->priv, SMA_SC_MAGIC);
+	return (sma_sc->sma_max - sma_sc->stats->nbytes);
+}
+
 static void
 sma_init(struct stevedore *parent, int ac, char * const *av)
 {
@@ -199,4 +217,6 @@
 	.alloc	=	sma_alloc,
 	.free	=	sma_free,
 	.trim	=	sma_trim,
+	.var_free_space =	sma_free_space,
+	.var_used_space =	sma_used_space,
 };




More information about the varnish-commit mailing list