Re: How can I find detailed comment about Squid src?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sun, 7 Apr 2002 14:20:01 +0200

On Sunday 07 April 2002 08:27, 马琳 wrote:
> Hi, I am using squid 2.4 stable. When I am reading the source
> codes, I always run in trouble. Because I do not know the exact
> meaning of thre variables of structures.

Welcome in the club ;-)

> For example, in file store_heap_replacement.c, line 108
> heap_key
> HeapKeyGen_StoreEntry_GDSF(void *entry, double 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=%ld lastref=%ld age=%f tie=%f -> %f\n",
> storeKeyText(e->hash.key), size, e->refcount, e->lastref, age,
> tie, key); if (e->mem_obj && e->mem_obj->url)
> debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: url=%s\n",
> e->mem_obj->url);
> return key;
> }
>
> What is the exact meaning of "age"? Can anyone give me a brief
> explanation?

In this specific case, age is the currently smallest key in the heap
I think. Perhaps more information is in the paper explaining the heap
policies. See lib/heap.c and src/repl/heap/store_repl_heap.c for the
source relating to this specific "age".

> Where can iI find the explanation of the variables of structures?

Not all of Squid is explained. Actually very little of Squid is
explained. The currently best explanation for most things is the
source itself, by tracing how the variable/structure in question is
being used.

Regards
Henrik
Received on Sun Apr 07 2002 - 15:58:02 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:58 MST