From adbbf6022d6d5e23bffa787043e854cce6072e50 Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 29 Jun 2006 19:06:44 +0000 Subject: [PATCH] Track objects heap-position git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@269 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 1 + varnish-cache/bin/varnishd/cache_expire.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 54507eb3..3018ef07 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -70,6 +70,7 @@ struct object { struct objhead *objhead; pthread_cond_t cv; + unsigned heap_idx; unsigned ban_seq; unsigned valid; diff --git a/varnish-cache/bin/varnishd/cache_expire.c b/varnish-cache/bin/varnishd/cache_expire.c index c76b842a..2334c2b6 100644 --- a/varnish-cache/bin/varnishd/cache_expire.c +++ b/varnish-cache/bin/varnishd/cache_expire.c @@ -115,6 +115,14 @@ object_cmp(void *priv, void *a, void *b) return (aa->ttl < bb->ttl); } +static void +object_update(void *priv, void *p, unsigned u) +{ + struct object *o = p; + + o->heap_idx = u; +} + /*--------------------------------------------------------------------*/ void @@ -124,6 +132,6 @@ EXP_Init(void) AZ(pthread_mutex_init(&exp_mtx, NULL)); AZ(pthread_create(&exp_thread, NULL, exp_prefetch, NULL)); AZ(pthread_create(&exp_thread, NULL, exp_hangman, NULL)); - exp_heap = binheap_new(NULL, object_cmp, NULL); + exp_heap = binheap_new(NULL, object_cmp, object_update); assert(exp_heap != NULL); } -- 2.39.5