2 # This patch to djbdns 1.05 modifies the dnscache program to keep a
3 # counter of cache hits and cache misses.
5 # Two new fields are added to the ``stats'' output line:
6 # . the fifth number is the number of cache hits
7 # . the sixth number is the number of cache misses
9 # @400000003fa92ccc317d70f4 stats 3 1201 1 0 21 49
10 # indicates 21 hits and 49 misses.
12 # James Raftery <james@now.ie> 6 Nov. 2003
14 --- djbdns-1.05.orig/cache.c Sun Feb 11 21:11:45 2001
15 +++ djbdns-1.05/cache.c Wed Nov 5 17:21:06 2003
18 uint64 cache_motion = 0;
20 +/* record cache stats */
21 +/* James Raftery <james@now.ie> 6 Nov. 2003 */
22 +uint64 cache_hit = 0;
23 +uint64 cache_miss = 0;
29 if (u > size - pos - 20 - keylen) cache_impossible();
33 return x + pos + 20 + keylen;
36 nextpos = prevpos ^ get4(pos);
39 - if (++loop > 100) return 0; /* to protect against hash flooding */
40 + if (++loop > 100) { /* to protect against hash flooding */
50 --- djbdns-1.05.orig/cache.h Sun Feb 11 21:11:45 2001
51 +++ djbdns-1.05/cache.h Wed Nov 5 17:13:36 2003
55 extern uint64 cache_motion;
57 +/* record cache stats */
58 +/* James Raftery <james@now.ie> 6 Nov. 2003 */
59 +extern uint64 cache_hit;
60 +extern uint64 cache_miss;
62 extern int cache_init(unsigned int);
63 extern void cache_set(const char *,unsigned int,const char *,unsigned int,uint32);
64 extern char *cache_get(const char *,unsigned int,unsigned int *,uint32 *);
65 --- djbdns-1.05.orig/log.c Sun Feb 11 21:11:45 2001
66 +++ djbdns-1.05/log.c Wed Nov 5 17:21:12 2003
69 extern uint64 numqueries;
70 extern uint64 cache_motion;
72 + /* record cache stats */
73 + /* James Raftery <james@now.ie> 6 Nov. 2003 */
74 + extern uint64 cache_hit;
75 + extern uint64 cache_miss;
81 number(numqueries); space();
82 number(cache_motion); space();
83 number(uactive); space();
85 + number(tactive); space();
86 + number(cache_hit); space();