FileDocCategorySizeDatePackage
CacheFileManagerStatsImpl.javaAPI DocAzureus 3.0.3.44613Fri Aug 03 22:17:54 BST 2007com.aelitis.azureus.core.diskmanager.cache.impl

CacheFileManagerStatsImpl

public class CacheFileManagerStatsImpl extends Object implements CacheFileManagerStats
author
parg

Fields Summary
protected CacheFileManagerImpl
manager
protected org.gudy.azureus2.core3.util.Average
cache_read_average
protected org.gudy.azureus2.core3.util.Average
cache_write_average
protected org.gudy.azureus2.core3.util.Average
file_read_average
protected org.gudy.azureus2.core3.util.Average
file_write_average
protected long
last_cache_read
protected long
last_cache_write
protected long
last_file_read
protected long
last_file_write
protected AEMonitor
this_mon
Constructors Summary
protected CacheFileManagerStatsImpl(CacheFileManagerImpl _manager)

	
	
	
			 
	
		manager	= _manager;
	
Methods Summary
public longgetAverageBytesReadFromCache()

		return( cache_read_average.getAverage() );
	
public longgetAverageBytesReadFromFile()

		return( file_read_average.getAverage() );
	
public longgetAverageBytesWrittenToCache()

		return( cache_write_average.getAverage());
	
public longgetAverageBytesWrittenToFile()

		return( file_write_average.getAverage() );
	
public boolean[]getBytesInCache(org.gudy.azureus2.core3.torrent.TOTorrent torrent, long[] absoluteOffsets, long[] lengths)

		return manager.getBytesInCache( torrent, absoluteOffsets, lengths);
	
public longgetBytesReadFromCache()

		return( manager.getBytesReadFromCache());
	
public longgetBytesReadFromFile()

		return( manager.getBytesReadFromFile());
	
public longgetBytesWrittenToCache()

		return( manager.getBytesWrittenToCache());
	
public longgetBytesWrittenToFile()

		return( manager.getBytesWrittenToFile());
	
public longgetCacheReadCount()

		return( manager.getCacheReadCount());
	
public longgetCacheWriteCount()

		return( manager.getCacheWriteCount());
	
public longgetFileReadCount()

		return( manager.getFileReadCount());
	
public longgetFileWriteCount()

		return( manager.getFileWriteCount());
	
public longgetSize()

		return( manager.getCacheSize());
	
public longgetUsedSize()

		return( manager.getCacheUsed());
	
protected voidupdate()

		try{
			this_mon.enter();
		
				// cache read
			
			long	cache_read		= manager.getBytesReadFromCache();
			long	cache_read_diff	= cache_read - last_cache_read;
			
			last_cache_read	= cache_read;
			
			cache_read_average.addValue( cache_read_diff );
			
				// cache write
			
			long	cache_write		= manager.getBytesWrittenToCache();
			long	cache_write_diff	= cache_write - last_cache_write;
			
			last_cache_write	= cache_write;
			
			cache_write_average.addValue( cache_write_diff );
	
				// file read
			
			long	file_read		= manager.getBytesReadFromFile();
			long	file_read_diff	= file_read - last_file_read;
			
			last_file_read	= file_read;
			
			file_read_average.addValue( file_read_diff );
			
				// file write
			
			long	file_write		= manager.getBytesWrittenToFile();
			long	file_write_diff	= file_write - last_file_write;
			
			last_file_write	= file_write;
			
			file_write_average.addValue( file_write_diff );
			
		}finally{
			
			this_mon.exit();
		}