diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2009-10-07 03:46:12 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-07 02:36:30 -0700 | 
| commit | c77583a4ae5ecf716edb4b7c7834fc804ba36dad (patch) | |
| tree | 4da8aab95a27c88bbc7e461a270bd3b4542b635a /xlators/performance/stat-prefetch/src/stat-prefetch.c | |
| parent | a9151c7c398f755abca20ec1055909f4ab4f3e0f (diff) | |
performance/stat-prefetch: Add accounting of cache hits and misses.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 284 (performance actually decreases for 'ls -l' on a directory containing large number of files with stat-prefetch loaded)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=284
Diffstat (limited to 'xlators/performance/stat-prefetch/src/stat-prefetch.c')
| -rw-r--r-- | xlators/performance/stat-prefetch/src/stat-prefetch.c | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index c5d05c4ae84..4b44b3f453b 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -558,6 +558,10 @@ sp_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)  wind:          if (lookup_behind) { +                if (cache) { +                        cache->hits++; +                } +                  wind_frame = copy_frame (frame);                  if (wind_frame == NULL) {                          op_ret = -1; @@ -579,6 +583,10 @@ wind:                  STACK_WIND (wind_frame, sp_lookup_behind_cbk, FIRST_CHILD(this),                              FIRST_CHILD(this)->fops->lookup, loc, xattr_req);          } else { +                if (cache) { +                        cache->miss++; +                } +                  STACK_WIND (frame, sp_lookup_cbk, FIRST_CHILD(this),                              FIRST_CHILD(this)->fops->lookup, loc, xattr_req); @@ -1756,10 +1764,17 @@ sp_release (xlator_t *this, fd_t *fd)          sp_fd_ctx_t *fd_ctx = NULL;          uint64_t     value  = 0;          int32_t      ret    = 0; +        sp_cache_t  *cache  = NULL;          ret = fd_ctx_del (fd, this, &value);          if (!ret) {                  fd_ctx = (void *)(long) value; +                cache = fd_ctx->cache; +                if (cache) { +                        gf_log (this->name, GF_LOG_DEBUG, "cache hits: %lu, " +                                "cache miss: %lu", cache->hits, cache->miss); +                } +                  sp_fd_ctx_free (fd_ctx);                }  | 
