if( free < 1024*1024 ) System.out.print( "free=" +free+ "B" );
else System.out.print( "free=" +free/1024/1024+ "MB" );
System.out.println();
CacheFileManager cm = null;
try{
cm = CacheFileManagerFactory.getSingleton();
}catch( Throwable e ){
Debug.printStackTrace( e );
}
synchronized( handed_out ){
Iterator it = handed_out.values().iterator();
Map cap_map = new TreeMap();
Map alloc_map = new TreeMap();
while( it.hasNext()){
DirectByteBuffer db = (DirectByteBuffer)it.next();
if ( verbose ){
String trace = db.getTraceString();
if ( trace != null ){
System.out.println( trace );
}
}
Integer cap = new Integer( db.getBufferInternal().capacity());
Byte alloc = new Byte( db.getAllocator());
myInteger c = (myInteger)cap_map.get(cap);
if ( c == null ){
c = new myInteger();
cap_map.put( cap, c );
}
c.value++;
myInteger a = (myInteger)alloc_map.get(alloc);
if ( a == null ){
a = new myInteger();
alloc_map.put( alloc, a );
}
a.value++;
}
it = cap_map.keySet().iterator();
while( it.hasNext()){
Integer key = (Integer)it.next();
myInteger count = (myInteger)cap_map.get( key );
if( key.intValue() < 1024 ){
System.out.print("[" +key.intValue()+ " x " +count.value+ "] ");
}else{
System.out.print("[" +key.intValue()/1024+ "K x " +count.value+ "] ");
}
}
System.out.println();
it = alloc_map.keySet().iterator();
while( it.hasNext()){
Byte key = (Byte)it.next();
myInteger count = (myInteger)alloc_map.get( key );
System.out.print("[" + DirectByteBuffer.AL_DESCS[key.intValue()]+ " x " +count.value+ "] ");
}
if ( cm != null ){
CacheFileManagerStats stats = cm.getStats();
System.out.print( " - Cache: " );
System.out.print( "sz=" + stats.getSize());