subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1649626 - /subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
Date Mon, 05 Jan 2015 19:40:33 GMT
Author: stefan2
Date: Mon Jan  5 19:40:32 2015
New Revision: 1649626

URL: http://svn.apache.org/r1649626
Log:
Remove the unused segment hit counter from the membuffer code.
It is kept up-to-date but never actually used anywhere.

* subversion/libsvn_subr/cache-membuffer.c
  (svn_membuffer_t): Drop the HIT_COUNTER.
  (drop_entry,
   let_entry_age): One element less to update.
  (svn_cache__membuffer_cache_create): One element less to initialize.
  (increment_hit_counters): One element less to update.  Update the
                            rationale for our overflow non-handling.

Modified:
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1649626&r1=1649625&r2=1649626&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Mon Jan  5 19:40:32 2015
@@ -563,13 +563,6 @@ struct svn_membuffer_t
    */
   apr_uint32_t used_entries;
 
-  /* Sum of (read) hit counts of all used dictionary entries.
-   * In conjunction used_entries used_entries, this is used calculate
-   * the average hit count as part of the randomized LFU algorithm.
-   */
-  apr_uint64_t hit_count;
-
-
   /* Total number of calls to membuffer_cache_get.
    * Purely statistical information that may be used for profiling only.
    * Updates are not synchronized and values may be nonsensicle on some
@@ -1027,7 +1020,6 @@ drop_entry(svn_membuffer_t *cache, entry
   /* update global cache usage counters
    */
   cache->used_entries--;
-  cache->hit_count -= entry->hit_count;
   cache->data_used -= entry->size;
 
   /* extend the insertion window, if the entry happens to border it
@@ -1163,7 +1155,6 @@ let_entry_age(svn_membuffer_t *cache, en
 
   if (hits_removed)
     {
-      cache->hit_count -= hits_removed;
       entry->hit_count -= hits_removed;
     }
   else
@@ -1795,7 +1786,6 @@ svn_cache__membuffer_cache_create(svn_me
       c[seg].max_entry_size = max_entry_size;
 
       c[seg].used_entries = 0;
-      c[seg].hit_count = 0;
       c[seg].total_reads = 0;
       c[seg].total_writes = 0;
       c[seg].total_hits = 0;
@@ -2071,12 +2061,10 @@ static svn_error_t *
 increment_hit_counters(svn_membuffer_t *cache, entry_t *entry)
 {
   /* To minimize the memory footprint of the cache index, we limit local
-   * hit counters to 32 bits.  These may overflow and we must make sure that
-   * the global sums are still the sum of all local counters. */
-  if (++entry->hit_count == 0)
-    cache->hit_count -= APR_UINT32_MAX;
-  else
-    cache->hit_count++;
+   * hit counters to 32 bits.  These may overflow but we don't really
+   * care because at worst, ENTRY will be dropped from cache once every
+   * few billion hits. */
+  ++entry->hit_count;
 
   /* That one is for stats only. */
   cache->total_hits++;



Mime
View raw message