From 94b751907a4d811655c63416d5b04282d40c0bd6 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Mon, 25 Mar 1996 14:30:26 +0000 Subject: (statistics): New variable. (diskfs_check_cache): Keep statistics on cache performance. --- libdiskfs/name-cache.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libdiskfs') diff --git a/libdiskfs/name-cache.c b/libdiskfs/name-cache.c index e5158e08..60f6c3fb 100644 --- a/libdiskfs/name-cache.c +++ b/libdiskfs/name-cache.c @@ -46,6 +46,14 @@ struct lookup_cache /* Cache itself */ static struct lookup_cache *lookup_cache_head, *lookup_cache_tail; +/* Buffer to hold statistics */ +static struct +{ + long pos_hits; + long neg_hits; + long miss; +} statistics; + /* Node NP has just been found in DIR with NAME. If NP is null, that means that this name has been confirmed as absent in the directory. */ void @@ -153,15 +161,18 @@ diskfs_check_cache (struct node *dir, char *name) if (lc->np) { lc->np->references++; + statistics.pos_hits++; spin_unlock (&diskfs_node_refcnt_lock); return lc->np; } else { + statistics.neg_hits++; spin_unlock (&diskfs_node_refcnt_lock); return (struct node *) -1; } } + statistics.miss++; spin_unlock (&diskfs_node_refcnt_lock); return 0; } -- cgit v1.2.3