From b6a7f52cd16311740aeb7e554c6174a272d6cd40 Mon Sep 17 00:00:00 2001 From: hno <> Date: Mon, 8 Apr 2002 15:03:17 +0000 Subject: [PATCH] Changed "age" to "heap_age" to avoid confustion. Extended the "lost attribution" to include a reference to the heap paper --- src/repl/heap/store_heap_replacement.cc | 24 ++++++++++++------------ src/repl/heap/store_repl_heap.cc | 8 ++++++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/repl/heap/store_heap_replacement.cc b/src/repl/heap/store_heap_replacement.cc index f99820ad01..a6841c623b 100644 --- a/src/repl/heap/store_heap_replacement.cc +++ b/src/repl/heap/store_heap_replacement.cc @@ -1,6 +1,6 @@ /* - * $Id: store_heap_replacement.cc,v 1.7 2001/10/24 05:26:22 hno Exp $ + * $Id: store_heap_replacement.cc,v 1.8 2002/04/08 09:03:17 hno Exp $ * * DEBUG: section 20 Storage Manager Heap-based replacement * AUTHOR: John Dilley @@ -66,7 +66,7 @@ * turnarounds) */ heap_key -HeapKeyGen_StoreEntry_LFUDA(void *entry, double age) +HeapKeyGen_StoreEntry_LFUDA(void *entry, double heap_age) { StoreEntry *e = entry; heap_key key; @@ -77,9 +77,9 @@ HeapKeyGen_StoreEntry_LFUDA(void *entry, double age) tie = 0.0; else tie = 1.0 - exp((double) (e->lastref - squid_curtime) / 86400.0); - key = age + (double) e->refcount - tie; - debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: %s refcnt=%d lastref=%ld age=%f tie=%f -> %f\n", - storeKeyText(e->hash.key), (int)e->refcount, e->lastref, age, tie, key); + key = heap_age + (double) e->refcount - tie; + debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: %s refcnt=%d lastref=%ld heap_age=%f tie=%f -> %f\n", + storeKeyText(e->hash.key), (int)e->refcount, e->lastref, heap_age, tie, key); if (e->mem_obj && e->mem_obj->url) debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: url=%s\n", e->mem_obj->url); @@ -107,15 +107,15 @@ HeapKeyGen_StoreEntry_LFUDA(void *entry, double age) * turnarounds) */ heap_key -HeapKeyGen_StoreEntry_GDSF(void *entry, double age) +HeapKeyGen_StoreEntry_GDSF(void *entry, double heap_age) { StoreEntry *e = entry; heap_key key; double size = e->swap_file_sz ? (double) e->swap_file_sz : 1.0; double tie = (e->lastref > 1) ? (1.0 / e->lastref) : 1.0; - key = age + ((double) e->refcount / size) - tie; - debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: %s size=%f refcnt=%d lastref=%ld age=%f tie=%f -> %f\n", - storeKeyText(e->hash.key), size, (int)e->refcount, e->lastref, age, tie, key); + key = heap_age + ((double) e->refcount / size) - tie; + debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: %s size=%f refcnt=%d lastref=%ld heap_age=%f tie=%f -> %f\n", + storeKeyText(e->hash.key), size, (int)e->refcount, e->lastref, heap_age, tie, key); if (e->mem_obj && e->mem_obj->url) debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: url=%s\n", e->mem_obj->url); @@ -130,11 +130,11 @@ HeapKeyGen_StoreEntry_GDSF(void *entry, double age) * heap-based replacement policies... */ heap_key -HeapKeyGen_StoreEntry_LRU(void *entry, double age) +HeapKeyGen_StoreEntry_LRU(void *entry, double heap_age) { StoreEntry *e = entry; - debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: %s age=%f lastref=%f\n", - storeKeyText(e->hash.key), age, (double) e->lastref); + debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: %s heap_age=%f lastref=%f\n", + storeKeyText(e->hash.key), heap_age, (double) e->lastref); if (e->mem_obj && e->mem_obj->url) debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: url=%s\n", e->mem_obj->url); diff --git a/src/repl/heap/store_repl_heap.cc b/src/repl/heap/store_repl_heap.cc index 252a211d0a..2737d42055 100644 --- a/src/repl/heap/store_repl_heap.cc +++ b/src/repl/heap/store_repl_heap.cc @@ -1,13 +1,17 @@ /* - * $Id: store_repl_heap.cc,v 1.9 2002/04/08 08:48:47 hno Exp $ + * $Id: store_repl_heap.cc,v 1.10 2002/04/08 09:03:17 hno Exp $ * * DEBUG: section ? HEAP based removal policies * AUTHOR: Henrik Nordstrom * - * Based on the ideas of the HEAP policy implemented by John Dilley of + * Based on the ideas of the heap policy implemented by John Dilley of * Hewlett Packard. Rewritten from scratch when modularizing the removal * policy implementation of Squid. + * + * For details on the original heap policy work and the thinking behind see + * http://www.hpl.hp.com/techreports/1999/HPL-1999-69.html + * * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- -- 2.47.3