use our LRU cache, report stats in debug.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1815 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-10-18 01:32:23 +00:00
parent 3ee6e84676
commit c69bfc2ca3
@@ -1,5 +1,5 @@
// //
// $Id: CharacterManager.java,v 1.22 2002/06/19 23:31:57 mdb Exp $ // $Id: CharacterManager.java,v 1.23 2002/10/18 01:32:23 ray Exp $
package com.threerings.cast; package com.threerings.cast;
@@ -7,11 +7,10 @@ import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.HashMap; import java.util.HashMap;
import com.samskivert.util.LRUHashMap;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.samskivert.util.Tuple; import com.samskivert.util.Tuple;
import org.apache.commons.collections.LRUMap;
import com.threerings.media.util.Colorization; import com.threerings.media.util.Colorization;
import com.threerings.util.DirectionCodes; import com.threerings.util.DirectionCodes;
@@ -39,6 +38,9 @@ public class CharacterManager
ActionSequence action = (ActionSequence)iter.next(); ActionSequence action = (ActionSequence)iter.next();
_actions.put(action.name, action); _actions.put(action.name, action);
} }
// TODO
_frames.setTracking(true);
} }
/** /**
@@ -179,6 +181,10 @@ public class CharacterManager
_frames.put(key, frames); _frames.put(key, frames);
} }
int[] eff = _frames.getTrackedEffectiveness();
Log.debug("CharacterManager LRU [hits=" + eff[0] +
", misses=" + eff[1] + "].");
return frames; return frames;
} }
@@ -257,7 +263,7 @@ public class CharacterManager
protected HashMap _actions = new HashMap(); protected HashMap _actions = new HashMap();
/** A cache of composited animation frames. */ /** A cache of composited animation frames. */
protected LRUMap _frames = new LRUMap(ACTION_CACHE_SIZE); protected LRUHashMap _frames = new LRUHashMap(ACTION_CACHE_SIZE);
/** The character class to be created. */ /** The character class to be created. */
protected Class _charClass = CharacterSprite.class; protected Class _charClass = CharacterSprite.class;