/*
- * $Id: store_heap_replacement.cc,v 1.13 2003/09/29 10:24:00 robertc Exp $
+ * $Id$
*
* DEBUG: section 20 Storage Manager Heap-based replacement
* AUTHOR: John Dilley
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
/*
* The code in this file is Copyrighted (C) 1999 by Hewlett Packard.
- *
+ *
*
* For a description of these cache replacement policies see --
* http://www.hpl.hp.com/techreports/1999/HPL-1999-69.html
#include "store_heap_replacement.h"
#include "Store.h"
#include "MemObject.h"
+#include "SquidTime.h"
+
+#if HAVE_MATH_H
+#include <math.h>
+#endif
/*
* Key generation function to implement the LFU-DA policy (Least
* in cache regardless of size. Achieves lower hit rate than GDS
* because there are more large objects in cache (so less room for
* smaller popular objects).
- *
+ *
* This version implements a tie-breaker based upon recency
* (e->lastref): for objects that have the same reference count
* the most recent object wins (gets a higher key value).
" heap_age=" << heap_age << " tie=" << tie << " -> " << key);
if (e->mem_obj && e->mem_obj->url)
- debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: url=%s\n",
- e->mem_obj->url);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_LFUDA: url=" << e->mem_obj->url);
return (double) key;
}
-
/*
* Key generation function to implement the GDS-Frequency policy.
* Similar to Greedy Dual-Size Hits policy, but adds aging of
* keeping more small, popular objects in cache. Achieves lower
* byte hit rate than LFUDA because there are fewer large objects
* in cache.
- *
+ *
* This version implements a tie-breaker based upon recency
* (e->lastref): for objects that have the same reference count
* the most recent object wins (gets a higher key value).
" -> " << key);
if (e->mem_obj && e->mem_obj->url)
- debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: url=%s\n",
- e->mem_obj->url);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_GDSF: url=" << e->mem_obj->url);
return key;
}
HeapKeyGen_StoreEntry_LRU(void *entry, double heap_age)
{
StoreEntry *e = (StoreEntry *)entry;
- debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: %s heap_age=%f lastref=%f\n",
- e->getMD5Text(), heap_age, (double) e->lastref);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_LRU: " <<
+ e->getMD5Text() << " heap_age=" << heap_age <<
+ " lastref=" << (double) e->lastref );
if (e->mem_obj && e->mem_obj->url)
- debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: url=%s\n",
- e->mem_obj->url);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_LRU: url=" << e->mem_obj->url);
return (heap_key) e->lastref;
}