diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-03-25 14:30:26 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-03-25 14:30:26 +0000 |
commit | 94b751907a4d811655c63416d5b04282d40c0bd6 (patch) | |
tree | b4b089edd366e6b7ab9d48974400814fc7bb8055 | |
parent | bb74d931d6ded15b7bb587d1cc2e168cb91193f3 (diff) |
(statistics): New variable.
(diskfs_check_cache): Keep statistics on cache performance.
-rw-r--r-- | libdiskfs/name-cache.c | 11 |
1 files changed, 11 insertions, 0 deletions
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; } |