comparison src/org/dancres/blitz/entry/SleeveCache.java @ 18:62b11f04d859

Make cache partitioning configurable.
author Dan Creswell <dan.creswell@gmail.com>
date Sun, 05 Jul 2009 16:51:24 +0100
parents 46ac1a45718a
children 8417eaebf5ab
comparison
equal deleted inserted replaced
17:4580bb12db30 18:62b11f04d859
30 import org.dancres.blitz.config.CacheSize; 30 import org.dancres.blitz.config.CacheSize;
31 import org.dancres.blitz.config.Fifo; 31 import org.dancres.blitz.config.Fifo;
32 import org.dancres.blitz.config.EntryConstraints; 32 import org.dancres.blitz.config.EntryConstraints;
33 33
34 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong; 34 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
35 import org.dancres.blitz.config.ConfigurationFactory;
35 36
36 /** 37 /**
37 The organization of the space implementation can be viewed as being 38 The organization of the space implementation can be viewed as being
38 similar to a memory hierarchy with EntryReposImpl/SpaceImpl being where 39 similar to a memory hierarchy with EntryReposImpl/SpaceImpl being where
39 central processing happens. SleeveCache can be viewed as level 1 cache 40 central processing happens. SleeveCache can be viewed as level 1 cache
52 */ 53 */
53 class SleeveCache implements StatGenerator { 54 class SleeveCache implements StatGenerator {
54 static Logger theLogger = 55 static Logger theLogger =
55 Logging.newLogger("org.dancres.blitz.disk.SleeveCache"); 56 Logging.newLogger("org.dancres.blitz.disk.SleeveCache");
56 57
57 private static final int DESIRED_ENTRIES_PER_PARTITION = 128; 58 private static int DESIRED_ENTRIES_PER_PARTITION = 0;
59
60 static {
61 try {
62 DESIRED_ENTRIES_PER_PARTITION =
63 ((Integer) ConfigurationFactory.getEntry("cacheEntriesPerPartition", int.class,
64 new Integer(128))).intValue();
65
66 theLogger.log(Level.SEVERE, "Loaded config: " + ((Integer) ConfigurationFactory.getEntry("cacheEntriesPerPartition", int.class,
67 new Integer(128))).intValue());
68
69 } catch (ConfigurationException aCE) {
70 theLogger.log(Level.SEVERE, "Failed to source partition setup", aCE);
71 }
72 }
58 73
59 private final ArcCache[] theStoreCaches; 74 private final ArcCache[] theStoreCaches;
60 private final int theNumPartitions; 75 private final int theNumPartitions;
61 private final int thePartitionsMask; 76 private final int thePartitionsMask;
62 77