FileDocCategorySizeDatePackage
GlobalManagerStatsImpl.javaAPI DocAzureus 3.0.3.46128Fri Jun 29 13:28:44 BST 2007org.gudy.azureus2.core3.global.impl

GlobalManagerStatsImpl

public class GlobalManagerStatsImpl extends Object implements GlobalManagerStats
author
parg

Fields Summary
private GlobalManagerImpl
manager
private long
total_data_bytes_received
private long
total_protocol_bytes_received
private long
totalDiscarded
private long
total_data_bytes_sent
private long
total_protocol_bytes_sent
private int
data_send_speed_at_close
private Average
data_receive_speed
private Average
protocol_receive_speed
private Average
data_receive_speed_no_lan
private Average
protocol_receive_speed_no_lan
private Average
data_send_speed
private Average
protocol_send_speed
private Average
data_send_speed_no_lan
private Average
protocol_send_speed_no_lan
Constructors Summary
protected GlobalManagerStatsImpl(GlobalManagerImpl _manager)

  //average over 10s, update every 1000ms


	 
	
			 
	
		manager = _manager;
		
		load();
	
Methods Summary
public voiddataBytesReceived(int length, boolean LAN)

		total_data_bytes_received += length;
		if ( !LAN ){
			data_receive_speed_no_lan.addValue(length);
		}
		data_receive_speed.addValue(length);
	
public voiddataBytesSent(int length, boolean LAN)

		total_data_bytes_sent += length;
		if ( !LAN ){
			data_send_speed_no_lan.addValue(length);
		}
		data_send_speed.addValue(length);
	
public voiddiscarded(int length)

		this.totalDiscarded += length;
	
public intgetDataAndProtocolReceiveRate()

		return((int)( protocol_receive_speed.getAverage() + data_receive_speed.getAverage()));
	
public intgetDataAndProtocolSendRate()

		return((int)( protocol_send_speed.getAverage() + data_send_speed.getAverage()));
	
public intgetDataReceiveRate()

		return (int)data_receive_speed.getAverage();
	
public intgetDataReceiveRateNoLAN()

		return (int)data_receive_speed_no_lan.getAverage();
	
public intgetDataReceiveRateNoLAN(int average_period)

		return (int)(average_period<=0?data_receive_speed_no_lan.getAverage():data_receive_speed_no_lan.getAverage(average_period));
	
public intgetDataSendRate()

		return (int)data_send_speed.getAverage();
	
public intgetDataSendRateAtClose()

		return( data_send_speed_at_close );
	
public intgetDataSendRateNoLAN()

		return (int)data_send_speed_no_lan.getAverage();
	
public intgetDataSendRateNoLAN(int average_period)

		return (int)(average_period<=0?data_send_speed_no_lan.getAverage():data_send_speed_no_lan.getAverage(average_period));
	
public intgetProtocolReceiveRate()

		return (int)protocol_receive_speed.getAverage();
	
public intgetProtocolReceiveRateNoLAN()

		return (int)protocol_receive_speed_no_lan.getAverage();
	
public intgetProtocolReceiveRateNoLAN(int average_period)

		return (int)(average_period<=0?protocol_receive_speed_no_lan.getAverage():protocol_receive_speed_no_lan.getAverage(average_period));
	
public intgetProtocolSendRate()

		return (int)protocol_send_speed.getAverage();
	
public intgetProtocolSendRateNoLAN()

		return (int)protocol_send_speed_no_lan.getAverage();
	
public intgetProtocolSendRateNoLAN(int average_period)

		return (int)(average_period<=0?protocol_send_speed_no_lan.getAverage():protocol_send_speed_no_lan.getAverage(average_period));
	
public longgetTotalDataBytesReceived()

    	return total_data_bytes_received;
    
public longgetTotalDataBytesSent()

    	return total_data_bytes_sent;
    
public longgetTotalDiscardedRaw()

    	return totalDiscarded;
    
public longgetTotalProtocolBytesReceived()

    	return total_protocol_bytes_received;
    
public longgetTotalProtocolBytesSent()

    	return total_protocol_bytes_sent;
    
public longgetTotalSwarmsPeerRate(boolean downloading, boolean seeding)

    	return( manager.getTotalSwarmsPeerRate(downloading,seeding));
    
protected voidload()

		data_send_speed_at_close	= COConfigurationManager.getIntParameter( "globalmanager.stats.send.speed.at.close", 0 );
	
public voidprotocolBytesReceived(int length, boolean LAN)

		total_protocol_bytes_received += length;
		if ( !LAN ){
			protocol_receive_speed_no_lan.addValue(length);
		}
		protocol_receive_speed.addValue(length);
	
public voidprotocolBytesSent(int length, boolean LAN)

		total_protocol_bytes_sent += length;
		if ( !LAN ){
			protocol_send_speed_no_lan.addValue(length);
		}
		protocol_send_speed.addValue(length);
	
protected voidsave()

		COConfigurationManager.setParameter( "globalmanager.stats.send.speed.at.close", getDataSendRate());