FileDocCategorySizeDatePackage
PEPeerStatsImpl.javaAPI DocAzureus 3.0.3.45555Thu Feb 01 22:32:58 GMT 2007org.gudy.azureus2.core3.peer.impl

PEPeerStatsImpl

public class PEPeerStatsImpl extends Object implements PEPeerStats
author
parg

Fields Summary
private PEPeer
owner
private long
total_data_bytes_received
private long
total_protocol_bytes_received
private final Average
data_receive_speed
private final Average
protocol_receive_speed
private long
total_data_bytes_sent
private long
total_protocol_bytes_sent
private final Average
data_send_speed
private final Average
protocol_send_speed
private final Average
receive_speed_for_choking
private final Average
estimated_download_speed
private final Average
estimated_upload_speed
private long
total_bytes_discarded
private long
total_bytes_downloaded
private long
disk_read_bytes
private int
disk_read_count
private int
disk_aggregated_read_count
Constructors Summary
public PEPeerStatsImpl(PEPeer _owner)


	       
		  owner = _owner;
	  
Methods Summary
public voidbytesDiscarded(int num_bytes)

      total_bytes_discarded += num_bytes;
    
public voiddataBytesReceived(int num_bytes)

      total_data_bytes_received += num_bytes;
      data_receive_speed.addValue( num_bytes );
      receive_speed_for_choking.addValue( num_bytes );
    
public voiddataBytesSent(int num_bytes)

      total_data_bytes_sent += num_bytes;
      data_send_speed.addValue( num_bytes );
    
public voiddiskReadComplete(long bytes)

    	disk_read_bytes	+= bytes;
    	disk_read_count++;
    	if ( bytes > 0 ){
    		disk_aggregated_read_count++;
    	}
    
public intgetAggregatedDiskReadCount()

 return( disk_aggregated_read_count ); 
public longgetDataReceiveRate()

  return data_receive_speed.getAverage();  
public longgetDataSendRate()

  return data_send_speed.getAverage();  
public intgetDownloadRateLimitBytesPerSecond()

return owner.getDownloadRateLimitBytesPerSecond();
public longgetEstimatedDownloadRateOfPeer()

  return estimated_download_speed.getAverage();  
public longgetEstimatedUploadRateOfPeer()

  return estimated_upload_speed.getAverage();  
public PEPeergetPeer()

		  return( owner );
	  
public longgetProtocolReceiveRate()

  return protocol_receive_speed.getAverage();  
public longgetProtocolSendRate()

  return protocol_send_speed.getAverage();  
public longgetSmoothDataReceiveRate()

  return receive_speed_for_choking.getAverage();  
public longgetTotalBytesDiscarded()

  return total_bytes_discarded;  
public longgetTotalBytesDownloadedByPeer()

  return total_bytes_downloaded;  
public longgetTotalDataBytesReceived()

  return total_data_bytes_received;  
public longgetTotalDataBytesSent()

  return total_data_bytes_sent;  
public longgetTotalDiskReadBytes()

 return( disk_read_bytes ); 
public intgetTotalDiskReadCount()

 return( disk_read_count ); 
public longgetTotalProtocolBytesReceived()

  return total_protocol_bytes_received;  
public longgetTotalProtocolBytesSent()

  return total_protocol_bytes_sent;  
public intgetUploadRateLimitBytesPerSecond()

return owner.getUploadRateLimitBytesPerSecond();
public voidhasNewPiece(int piece_size)

      total_bytes_downloaded += piece_size;
      estimated_download_speed.addValue( piece_size );
    
public voidprotocolBytesReceived(int num_bytes)

      total_protocol_bytes_received += num_bytes;
      protocol_receive_speed.addValue( num_bytes );
      //dont count protocol overhead towards a peer's choke/unchoke value, only piece data
    
public voidprotocolBytesSent(int num_bytes)

      total_protocol_bytes_sent += num_bytes;
      protocol_send_speed.addValue( num_bytes );
    
public voidsetDownloadRateLimitBytesPerSecond(int bytes)

owner.setDownloadRateLimitBytesPerSecond( bytes );
public voidsetUploadRateLimitBytesPerSecond(int bytes)

owner.setUploadRateLimitBytesPerSecond( bytes );
public voidstatisticalSentPiece(int piece_size)

      estimated_upload_speed.addValue( piece_size );