public class SimpleCache extends CacheBase
Cache,
DoubleCache,
OptimizedCache| Modifier and Type | Field and Description |
|---|---|
int |
answer |
protected int |
bdds |
protected int |
cache_size |
int |
hash_value |
protected long |
hit |
protected long |
last_access |
protected long |
last_hit |
protected int |
members |
protected long |
miss |
protected long |
num_access |
protected int |
num_clears |
protected int |
num_grows |
protected int |
width |
| Constructor and Description |
|---|
SimpleCache(String name,
int size,
int members,
int bdds)
the arguments are:
(size of elements, number of members.
|
| Modifier and Type | Method and Description |
|---|---|
void |
check_cache(NodeTable nt) |
protected void |
clear_cache()
invalidate the complete cache
|
double |
computeHitRate()
the hit rate, 0-100%
|
double |
computeLoadFactor()
the load factor, 0-100%
|
void |
free_or_grow()
try to grow the cache.
|
void |
free_or_grow(NodeTable nt)
either _partially_ wipe the cache or try to grow it.
|
long |
getAccessCount()
number of times the cache was accessed
|
int |
getCacheSize()
size of the cache
|
protected int |
getIn(int i,
int member) |
long |
getMemoryUsage() |
int |
getNumberOfClears()
number of times cache was cleared
|
int |
getNumberOfGrows()
number of times cache was growed
|
int |
getNumberOfPartialClears()
number of times cache was partially
|
protected int |
getOut(int i) |
int |
getSize()
the _real_ size of the cache.
|
protected int |
good_hash(int i) |
protected int |
good_hash(int i,
int j) |
protected int |
good_hash(int i,
int j,
int k) |
protected void |
grow_and_invalidate_cache()
grow the cache and invalidate everything [since the hash function hash chagned]
|
void |
insert(int hash,
int key1,
int value)
this is the _correct_ way to insert something into the cache.
|
void |
insert(int hash,
int key1,
int key2,
int value)
this is the _correct_ way to insert something into the cache.
|
void |
insert(int hash,
int key1,
int key2,
int key3,
int value)
this is the _correct_ way to insert something into the cache.
|
static void |
internal_test()
testbench.
|
void |
invalidate_cache()
just wipe the cache
|
void |
invalidate_cache(NodeTable nt)
removes the elements that are garbage collected.
|
protected void |
invalidate(int number) |
protected boolean |
isValid(int number) |
boolean |
lookup(int a)
lookup the element associated with (a)
returns true if element found (stored in SimpleCache.answer)
returns false if element not found.
|
boolean |
lookup(int a,
int b)
lookup the element associated with (a,b)
returns true if element found (stored in SimpleCache.answer)
returns false if element not found.
|
boolean |
lookup(int a,
int b,
int c)
lookup the element associated with (a,b,c)
returns true if element found (stored in SimpleCache.answer)
returns false if element not found.
|
protected boolean |
may_grow()
see if we are allowed to grow this cache.
|
protected void |
setIn(int i,
int member,
int v) |
protected void |
setOut(int i,
int v) |
void |
show_tuple(int bdd) |
void |
showStats() |
public int answer
public int hash_value
protected int members
protected int width
protected int bdds
protected int num_clears
protected int num_grows
protected int cache_size
protected long num_access
protected long hit
protected long miss
protected long last_hit
protected long last_access
public SimpleCache(String name, int size, int members, int bdds)
protected final int getOut(int i)
protected final void setOut(int i,
int v)
protected final int getIn(int i,
int member)
protected final void setIn(int i,
int member,
int v)
protected final void clear_cache()
protected final void invalidate(int number)
protected final boolean isValid(int number)
public long getMemoryUsage()
public int getSize()
protected boolean may_grow()
public void invalidate_cache()
public void free_or_grow()
protected void grow_and_invalidate_cache()
public void free_or_grow(NodeTable nt)
free_or_grow()public void invalidate_cache(NodeTable nt)
public void insert(int hash,
int key1,
int value)
public void insert(int hash,
int key1,
int key2,
int value)
public void insert(int hash,
int key1,
int key2,
int key3,
int value)
public final boolean lookup(int a)
public final boolean lookup(int a,
int b)
public final boolean lookup(int a,
int b,
int c)
protected final int good_hash(int i)
protected final int good_hash(int i,
int j)
protected final int good_hash(int i,
int j,
int k)
public double computeLoadFactor()
CacheBasecomputeLoadFactor in class CacheBasepublic double computeHitRate()
CacheBasecomputeHitRate in class CacheBasepublic long getAccessCount()
CacheBasegetAccessCount in class CacheBasepublic int getCacheSize()
CacheBasegetCacheSize in class CacheBasepublic int getNumberOfClears()
CacheBasegetNumberOfClears in class CacheBasepublic int getNumberOfPartialClears()
CacheBasegetNumberOfPartialClears in class CacheBasepublic int getNumberOfGrows()
CacheBasegetNumberOfGrows in class CacheBasepublic void showStats()
public void show_tuple(int bdd)
public void check_cache(NodeTable nt)
public static void internal_test()
This file is a part of the JDD package, a native Java Binary Decision Diagram Library.