Report image cache performance in all relevant places.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2032 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ImageManager.java,v 1.28 2002/12/07 00:58:00 shaper Exp $
|
// $Id: ImageManager.java,v 1.29 2002/12/07 01:00:58 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.media;
|
package com.threerings.media;
|
||||||
|
|
||||||
@@ -68,12 +68,7 @@ public class ImageManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// periodically report our image cache performance
|
// periodically report our image cache performance
|
||||||
if (!_cacheStatThrottle.throttleOp()) {
|
reportCachePerformance();
|
||||||
int size = getCachedImageSize() / 1024;
|
|
||||||
int[] eff = _imgs.getTrackedEffectiveness();
|
|
||||||
Log.debug("ImageManager LRU [size=" + size + "k pixels" +
|
|
||||||
", hits=" + eff[0] + ", misses=" + eff[1] + "].");
|
|
||||||
}
|
|
||||||
|
|
||||||
String key = rset + ":" + path;
|
String key = rset + ":" + path;
|
||||||
Image img = (Image)_imgs.get(key);
|
Image img = (Image)_imgs.get(key);
|
||||||
@@ -125,6 +120,9 @@ public class ImageManager
|
|||||||
*/
|
*/
|
||||||
public Image getImage (String path)
|
public Image getImage (String path)
|
||||||
{
|
{
|
||||||
|
// periodically report our image cache performance
|
||||||
|
reportCachePerformance();
|
||||||
|
|
||||||
Image img = (Image)_imgs.get(path);
|
Image img = (Image)_imgs.get(path);
|
||||||
if (img != null) {
|
if (img != null) {
|
||||||
// Log.info("Retrieved image from cache [path=" + path + "].");
|
// Log.info("Retrieved image from cache [path=" + path + "].");
|
||||||
@@ -150,6 +148,20 @@ public class ImageManager
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports statistics detailing the image manager cache performance
|
||||||
|
* and the current size of the cached images.
|
||||||
|
*/
|
||||||
|
protected void reportCachePerformance ()
|
||||||
|
{
|
||||||
|
if (!_cacheStatThrottle.throttleOp()) {
|
||||||
|
int size = getCachedImageSize() / 1024;
|
||||||
|
int[] eff = _imgs.getTrackedEffectiveness();
|
||||||
|
Log.debug("ImageManager LRU [size=" + size + "k pixels" +
|
||||||
|
", hits=" + eff[0] + ", misses=" + eff[1] + "].");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the image via the resource manager using the specified
|
* Loads the image via the resource manager using the specified
|
||||||
* path. Does no caching and does not convert the image for optimized
|
* path. Does no caching and does not convert the image for optimized
|
||||||
|
|||||||
Reference in New Issue
Block a user