|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.graphs.GraphCache sofya.graphs.cfg.CFGCache
public class CFGCache
Disk backed soft memory cache for control flow graphs (CFGs) which uses a least recently used (LRU) policy to cache graphs to disk.
This class provides the implementation to serialize CFGs to binary flat files on disk.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class sofya.graphs.GraphCache |
---|
GraphCache.CachedGraph |
Constructor Summary | |
---|---|
CFGCache()
Creates a new CFG cache with a default minimum memory threshold and disk caching policy. |
|
CFGCache(int initRemoveNum)
Creates a new CFG cache with a default minimum memory threshold which immediately caches a given number of graphs to disk when the threshold is passed. |
|
CFGCache(int initRemoveNum,
float lowMemThreshold)
Creates a new CFG cache which immediately caches the specified number of graphs when the given minimum memory threshold is passed. |
Method Summary | |
---|---|
static void |
main(java.lang.String[] argv)
Simple test driver. |
protected Graph |
readFromDisk(MethodSignature method)
Reads a CFG from a cache file. |
protected void |
writeToDisk(MethodSignature method,
Graph g)
Writes a CFG to a cache file. |
Methods inherited from class sofya.graphs.GraphCache |
---|
clear, containsKey, get, getForClass, iterator, iterator, keySet, keySet, put, remove, size, sortedIterator, sortedIterator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CFGCache()
public CFGCache(int initRemoveNum)
initRemoveNum
- Number of graphs to immediately cache to disk
when available memory falls below the minimum threshold. Higher
values may improve performance by immediately clearing more memory
and thus reducing the frequency with which the cache must search
for and cache eligible CFGs.public CFGCache(int initRemoveNum, float lowMemThreshold)
initRemoveNum
- Number of graphs to immediately cache to disk
when available memory falls below the minimum threshold. Higher
values may improve performance by immediately clearing more memory
and thus reducing the frequency with which the cache must search
for and cache eligible CFGs.lowMemThreshold
- Minimum free memory, as a percentage of total
memory, that the cache must attempt to keep free. Setting this value
too high may result in disk thrashing.Method Detail |
---|
protected Graph readFromDisk(MethodSignature method) throws CacheException
readFromDisk
in class GraphCache
method
- Signature of the method for which to retrieve the
CFG from the cache file.
CacheException
- If reading of the cache file fails, which
may occur if no cache file exists for the requested method or
if the cache file is unreadable or corrupted in some way.protected void writeToDisk(MethodSignature method, Graph g) throws CacheException
writeToDisk
in class GraphCache
method
- Signature of the method being written to file.g
- CFG being written to the cache file.
CacheException
- If the cache file cannot be created or
written.public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |