Go to the documentation of this file.
83 if (strcasecmp(s,
"GET") == 0) {
85 }
else if (strcasecmp(s,
"POST") == 0) {
87 }
else if (strcasecmp(s,
"PUT") == 0) {
89 }
else if (strcasecmp(s,
"HEAD") == 0) {
91 }
else if (strcasecmp(s,
"CONNECT") == 0) {
93 }
else if (strcasecmp(s,
"TRACE") == 0) {
95 }
else if (strcasecmp(s,
"PURGE") == 0) {
113 fi->
file = fopen(fname,
"r");
116 fprintf(stderr,
"cannot open %s: %s\n", fname,
strerror(errno));
119 fprintf(stderr,
"opened %s\n", fname);
133 fprintf(stderr,
"closed %s\n", fi->
fname);
167 else if (res ==
frEof) {
168 fprintf(stderr,
"exhausted %s (%d entries) at %s",
179 fprintf(stderr,
"%s scanned %d K entries (%d bad) at %s",
211 assert(name && strlen(name));
247 struct timeval t_start, t_end;
250 fprintf(stderr,
"%s: init-ing digest with %d entries\n", cache->
name, cache->
count);
260 gettimeofday(&t_start,
NULL);
268 gettimeofday(&t_end,
NULL);
270 fprintf(stderr,
"%s: init-ed digest with %d entries\n",
272 fprintf(stderr,
"%s: init took: %f sec, %f sec/M\n",
277 gettimeofday(&t_start,
NULL);
282 gettimeofday(&t_end,
NULL);
283 fprintf(stderr,
"%s: hash scan took: %f sec, %f sec/M\n",
293 const int we_think_we_have_it = cache->
digest->test(key);
298 if (we_think_we_have_it)
303 if (we_think_we_have_it)
313 fprintf(stdout,
"%s: peer queries: %d (%d%%)\n",
317 fprintf(stdout,
"%s: t-hit: %d (%d%%) t-miss: %d (%d%%) t-*: %d (%d%%)\n",
321 stats->true_hit_count +
stats->true_miss_count,
324 fprintf(stdout,
"%s: f-hit: %d (%d%%) f-miss: %d (%d%%) f-*: %d (%d%%)\n",
328 stats->false_hit_count +
stats->false_miss_count,
336 fprintf(stdout,
"%s: entries: %d reqs: %d bad-add: %d bad-del: %d\n",
355 storeSwapLogData *entry;
360 entry = (storeSwapLogData *)fi->
entry;
362 if (fread(entry,
sizeof(*entry), 1, fi->
file) != 1)
368 fprintf(stderr,
"%s:%d: unknown swap log action\n", fi->
fname, fi->
line_count);
378 static char buf[4096];
394 if (!fgets(buf,
sizeof(buf), fi->
file))
399 url = strstr(buf,
"://");
401 hier = url ? strstr(url,
" - ") :
NULL;
436 *strchr(hier,
'/') =
'\0';
440 entry->
use_icp = strcmp(hier,
"NONE");
519 fprintf(stderr,
"usage: %s <access_log> <swap_state> ...\n",
528 const int fi_count = argc - 1;
529 int active_fi_count = 0;
535 return usage(argv[0]);
550 for (i = 2; i < argc; ++i)
554 for (i = 0; i < fi_count; ++i)
561 for (i = 1; i < fi_count; ++i) {
571 if (ready_time > 0 && fi->
inner_time > ready_time)
594 time_t next_time = -1;
597 for (i = 0; i < fi_count; ++i) {
598 if (fis[i]->inner_time >= 0) {
599 if (!active_fi_count || fis[i]->inner_time < next_time) {
619 }
while (active_fi_count);
629 for (i = 0; i < argc - 1; ++i) {
fr_result(* FI_READER)(FileIterator *fi)
double tvSubDsec(struct timeval t1, struct timeval t2)
class Ping::pingStats_ stats
void * xcalloc(size_t n, size_t sz)
static fr_result swapStateReader(FileIterator *fi)
static void cacheEntryDestroy(CacheEntry *e)
unsigned char cache_key
Store key.
const cache_key * storeKeyPublic(const char *url, const HttpRequestMethod &method, const KeyScope keyScope)
static void cacheQueryReport(Cache *cache, CacheQueryStats *stats)
static FileIterator * fileIteratorCreate(const char *fname, FI_READER reader)
SQUIDCEXTERN void hash_remove_link(hash_table *, hash_link *)
static void cacheResetDigest(Cache *cache)
static Cache * cacheCreate(const char *name)
static fr_result accessLogReader(FileIterator *fi)
static void fileIteratorSetCurTime(FileIterator *fi, time_t ct)
static void cacheReport(Cache *cache)
SQUIDCEXTERN void hash_join(hash_table *, hash_link *)
SQUIDCEXTERN void hashFreeMemory(hash_table *)
static int usage(const char *prg_name)
CacheDigest * clone() const
produce a new identical copy of the digest object
void remove(const cache_key *key)
static void cacheQueryPeer(Cache *cache, const cache_key *key)
cache_key key[SQUID_MD5_DIGEST_LENGTH]
#define SQUID_MD5_DIGEST_LENGTH
static void cachePurge(Cache *cache, storeSwapLogData *s, int update_digest)
static CacheEntry * cacheEntryCreate(const storeSwapLogData *s)
static void fileIteratorDestroy(FileIterator *fi)
struct _CacheEntry CacheEntry
static void fileIteratorAdvance(FileIterator *fi)
SQUIDCEXTERN void hash_first(hash_table *)
static void cacheUpdateStore(Cache *cache, storeSwapLogData *s, int update_digest)
unsigned char key_arr[SQUID_MD5_DIGEST_LENGTH]
static void cacheStore(Cache *cache, storeSwapLogData *s, int update_digest)
void add(const cache_key *key)
static void cacheFetch(Cache *cache, const RawAccessLogEntry *e)
struct _CacheEntry * next
int main(int argc, char *argv[])
HASHHASH storeKeyHashHash
SQUIDCEXTERN hash_link * hash_next(hash_table *)
static HttpRequestMethod methodStrToId(const char *s)
SQUIDCEXTERN hash_table * hash_create(HASHCMP *, int, HASHHASH *)
SQUIDCEXTERN hash_link * hash_lookup(hash_table *, const void *)
SQUIDCEXTERN int xpercentInt(double part, double whole)
static void cacheDestroy(Cache *cache)