## net.i2p.router.peermanager
Class PeerProfile

    java.lang.Object
      net.i2p.router.peermanager.PeerProfile

public class PeerProfile
extends java.lang.Object

Constructor Summary
`PeerProfile(RouterContext context, Hash peer)`
`PeerProfile(RouterContext context, Hash peer, boolean expand)`

Method Summary
`void` `coalesceStats()` update the stats and rates (this should be called once a minute)
`(package private) void` `dataPushed(int size)`
`(package private) void` `dataPushed1m(int size)` the tunnel pushed that much data in a 1 minute period
`boolean` `equals(java.lang.Object obj)`
`void` `expandProfile()` When the given peer is performing well enough that we want to keep detailed stats on them again, call this to set up the info we dropped during shrinkProfile.
`double` `getCapacityBonus()` extra factor added to the capacity ranking - this can be updated in the profile written to disk to affect how the algorithm ranks capacity.
`double` `getCapacityValue()` How many tunnels do we think this peer can handle over the next hour?
`RateStat` `getCommError()` how long between communication errors with the peer (disconnection, etc), calculated over a 1 minute, 1 hour, and 1 day period
`DBHistory` `getDBHistory()` history of db activity with the peer
`RateStat` `getDbIntroduction()` how many new peers we get from dbSearchReplyMessages or dbStore messages, calculated over a 1 hour, 1 day, and 1 week period
`RateStat` `getDbResponseTime()` how long it takes to get a db response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period
`long` `getFirstHeardAbout()` when did we first hear about this peer?
`long` `getIntegrationBonus()` extra factor added to the integration ranking - this can be updated in the profile written to disk to affect how the algorithm ranks integration.
`double` `getIntegrationValue()` How well integrated into the network is this peer (as measured by how much they've told us that we didn't already know).
`boolean` `getIsActive()` Is this peer active at the moment (sending/receiving messages within the last 5 minutes)
`boolean` `getIsActive(long period)` Is this peer active at the moment (sending/receiving messages within the given period?)
`boolean` `getIsExpanded()` are we keeping an expanded profile on the peer, or just the bare minimum.
`boolean` `getIsFailing()` is this peer actively failing (aka not worth touching)?
`long` `getLastHeardAbout()` when did we last hear about this peer?
`long` `getLastHeardFrom()` when did we last hear from the peer?
`long` `getLastSendFailed()` when did we last have a problem sending to this peer?
`long` `getLastSendSuccessful()` when did we last send to this peer successfully?
`double` `getOldSpeedValue()`
`double` `getPeakThroughputKBps()`
`double` `getPeakTunnel1mThroughputKBps()`
`double` `getPeakTunnelThroughputKBps()`
`Hash` `getPeer()` what peer is being profiled
`RateStat` `getReceiveSize()` how large received messages are, calculated over a 1 minute, 1 hour, and 1 day period
`long` `getReliabilityBonus()` extra factor added to the reliability ranking - this can be updated in the profile written to disk to affect how the algorithm ranks reliability.
`double` `getReliabilityValue()` How likely are they to stay up and pass on messages over the next few minutes.
`RateStat` `getSendFailureSize()` how large messages that could not be sent were, calculated over a 1 minute, 1 hour, and 1 day period
`RateStat` `getSendSuccessSize()` how large successfully sent messages are, calculated over a 1 minute, 1 hour, and 1 day period
`long` `getSpeedBonus()` extra factor added to the speed ranking - this can be updated in the profile written to disk to affect how the algorithm ranks speed.
`double` `getSpeedValue()` How fast is the peer, taking into consideration both throughput and latency.
`RateStat` `getTunnelCreateResponseTime()` how long it takes to get a tunnel create response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period
`TunnelHistory` `getTunnelHistory()` history of tunnel activity with the peer
`RateStat` `getTunnelTestResponseTime()` how long it takes to successfully test a tunnel this peer participates in (in milliseconds), calculated over a 10 minute, 1 hour, and 1 day period
`RateStat` `getTunnelTestResponseTimeSlow()` how long it takes to successfully test the peer (in milliseconds) when the time exceeds 5s
`double` `getTunnelTestTimeAverage()`
`int` `hashCode()`
`int` `incrementShitlists()`
`static void` `main(java.lang.String[] args)` Read in all of the profiles specified and print out their calculated values.
`static void` `main2(java.lang.String[] args)` Calculate the memory consumption of profiles.
`void` `setCapacityBonus(long bonus)`
`void` `setDBHistory(DBHistory hist)`
`void` `setFirstHeardAbout(long when)`
`void` `setIntegrationBonus(long bonus)`
`(package private) void` `setIsFailing(boolean val)`
`void` `setLastHeardAbout(long when)`
`void` `setLastHeardFrom(long when)`
`void` `setLastSendFailed(long when)`
`void` `setLastSendSuccessful(long when)`
`void` `setPeakThroughputKBps(double kBps)`
`void` `setPeakTunnel1mThroughputKBps(double kBps)`
`void` `setPeakTunnelThroughputKBps(double kBps)`
`void` `setPeer(Hash peer)`
`void` `setReliabilityBonus(long bonus)`
`void` `setSpeedBonus(long bonus)`
`void` `setTunnelHistory(TunnelHistory history)`
`(package private) void` `setTunnelTestTimeAverage(double avg)`
`void` `shrinkProfile()` when the given peer is performing so poorly that we don't want to bother keeping extensive stats on them, call this to discard excess data points.
`java.lang.String` `toString()`
`(package private) void` `tunnelDataTransferred(long tunnelByteLifetime)` the tunnel pushed that much data in its lifetime
`void` `unshitlist()`
`(package private) void` `updateTunnelTestTimeAverage(long ms)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PeerProfile

    public PeerProfile(RouterContext context,
                       Hash peer)

### PeerProfile

    public PeerProfile(RouterContext context,
                       Hash peer,
                       boolean expand)

Method Detail

### getPeer

    public Hash getPeer()

  what peer is being profiled

### setPeer

    public void setPeer(Hash peer)

### getIsExpanded

    public boolean getIsExpanded()

  are we keeping an expanded profile on the peer, or just the bare minimum. If we aren't keeping the expanded profile, all of the rates as well as the TunnelHistory and DBHistory will not be available.

### incrementShitlists

    public int incrementShitlists()

### unshitlist

    public void unshitlist()

### getIsActive

    public boolean getIsActive()

  Is this peer active at the moment (sending/receiving messages within the last 5 minutes)

### getIsActive

    public boolean getIsActive(long period)

  Is this peer active at the moment (sending/receiving messages within the given period?)

### getFirstHeardAbout

    public long getFirstHeardAbout()

  when did we first hear about this peer?

### setFirstHeardAbout

    public void setFirstHeardAbout(long when)

### getLastHeardAbout

    public long getLastHeardAbout()

  when did we last hear about this peer?

### setLastHeardAbout

    public void setLastHeardAbout(long when)

### getLastSendSuccessful

    public long getLastSendSuccessful()

  when did we last send to this peer successfully?

### setLastSendSuccessful

    public void setLastSendSuccessful(long when)

### getLastSendFailed

    public long getLastSendFailed()

  when did we last have a problem sending to this peer?

### setLastSendFailed

    public void setLastSendFailed(long when)

### getLastHeardFrom

    public long getLastHeardFrom()

  when did we last hear from the peer?

### setLastHeardFrom

    public void setLastHeardFrom(long when)

### getTunnelHistory

    public TunnelHistory getTunnelHistory()

  history of tunnel activity with the peer

### setTunnelHistory

    public void setTunnelHistory(TunnelHistory history)

### getDBHistory

    public DBHistory getDBHistory()

  history of db activity with the peer

### setDBHistory

    public void setDBHistory(DBHistory hist)

### getSendSuccessSize

    public RateStat getSendSuccessSize()

  how large successfully sent messages are, calculated over a 1 minute, 1 hour, and 1 day period

### getSendFailureSize

    public RateStat getSendFailureSize()

  how large messages that could not be sent were, calculated over a 1 minute, 1 hour, and 1 day period

### getReceiveSize

    public RateStat getReceiveSize()

  how large received messages are, calculated over a 1 minute, 1 hour, and 1 day period

### getDbResponseTime

    public RateStat getDbResponseTime()

  how long it takes to get a db response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period

### getTunnelCreateResponseTime

    public RateStat getTunnelCreateResponseTime()

  how long it takes to get a tunnel create response from the peer (in milliseconds), calculated over a 1 minute, 1 hour, and 1 day period

### getTunnelTestResponseTime

    public RateStat getTunnelTestResponseTime()

  how long it takes to successfully test a tunnel this peer participates in (in milliseconds), calculated over a 10 minute, 1 hour, and 1 day period

### getTunnelTestResponseTimeSlow

    public RateStat getTunnelTestResponseTimeSlow()

  how long it takes to successfully test the peer (in milliseconds) when the time exceeds 5s

### getCommError

    public RateStat getCommError()

  how long between communication errors with the peer (disconnection, etc), calculated over a 1 minute, 1 hour, and 1 day period

### getDbIntroduction

    public RateStat getDbIntroduction()

  how many new peers we get from dbSearchReplyMessages or dbStore messages, calculated over a 1 hour, 1 day, and 1 week period

### getSpeedBonus

    public long getSpeedBonus()

  extra factor added to the speed ranking - this can be updated in the profile written to disk to affect how the algorithm ranks speed. Negative values are penalties

### setSpeedBonus

    public void setSpeedBonus(long bonus)

### getReliabilityBonus

    public long getReliabilityBonus()

  extra factor added to the reliability ranking - this can be updated in the profile written to disk to affect how the algorithm ranks reliability. Negative values are penalties

### setReliabilityBonus

    public void setReliabilityBonus(long bonus)

### getCapacityBonus

    public double getCapacityBonus()

  extra factor added to the capacity ranking - this can be updated in the profile written to disk to affect how the algorithm ranks capacity. Negative values are penalties

### setCapacityBonus

    public void setCapacityBonus(long bonus)

### getIntegrationBonus

    public long getIntegrationBonus()

  extra factor added to the integration ranking - this can be updated in the profile written to disk to affect how the algorithm ranks integration. Negative values are penalties

### setIntegrationBonus

    public void setIntegrationBonus(long bonus)

### getSpeedValue

    public double getSpeedValue()

  How fast is the peer, taking into consideration both throughput and latency. This may even be made to take into consideration current rates vs. estimated (or measured) max rates, allowing this speed to reflect the speed /available/.

### getOldSpeedValue

    public double getOldSpeedValue()

### getReliabilityValue

    public double getReliabilityValue()

  How likely are they to stay up and pass on messages over the next few minutes. Positive numbers means more likely, negative numbers means its probably not even worth trying.

### getCapacityValue

    public double getCapacityValue()

  How many tunnels do we think this peer can handle over the next hour?

### getIntegrationValue

    public double getIntegrationValue()

  How well integrated into the network is this peer (as measured by how much they've told us that we didn't already know). Higher numbers means better integrated

### getIsFailing

    public boolean getIsFailing()

  is this peer actively failing (aka not worth touching)?

### getTunnelTestTimeAverage

    public double getTunnelTestTimeAverage()

### setTunnelTestTimeAverage

    void setTunnelTestTimeAverage(double avg)

### updateTunnelTestTimeAverage

    void updateTunnelTestTimeAverage(long ms)

### getPeakThroughputKBps

    public double getPeakThroughputKBps()

### setPeakThroughputKBps

    public void setPeakThroughputKBps(double kBps)

### dataPushed

    void dataPushed(int size)

### tunnelDataTransferred

    void tunnelDataTransferred(long tunnelByteLifetime)

  the tunnel pushed that much data in its lifetime

### getPeakTunnelThroughputKBps

    public double getPeakTunnelThroughputKBps()

### setPeakTunnelThroughputKBps

    public void setPeakTunnelThroughputKBps(double kBps)

### dataPushed1m

    void dataPushed1m(int size)

  the tunnel pushed that much data in a 1 minute period

### getPeakTunnel1mThroughputKBps

    public double getPeakTunnel1mThroughputKBps()

### setPeakTunnel1mThroughputKBps

    public void setPeakTunnel1mThroughputKBps(double kBps)

### shrinkProfile

    public void shrinkProfile()

  when the given peer is performing so poorly that we don't want to bother keeping extensive stats on them, call this to discard excess data points. Specifically, this drops the rates, the tunnelHistory, and the dbHistory.

### expandProfile

    public void expandProfile()

  When the given peer is performing well enough that we want to keep detailed stats on them again, call this to set up the info we dropped during shrinkProfile. This will not however overwrite any existing data, so it can be safely called repeatedly

### coalesceStats

    public void coalesceStats()

  update the stats and rates (this should be called once a minute)

### setIsFailing

    void setIsFailing(boolean val)

### hashCode

    public int hashCode()

### equals

    public boolean equals(java.lang.Object obj)

### toString

    public java.lang.String toString()

### main2

    public static void main2(java.lang.String[] args)

  Calculate the memory consumption of profiles. Measured to be ~3739 bytes for an expanded profile, and ~212 bytes for a compacted one.

### main

    public static void main(java.lang.String[] args)

  Read in all of the profiles specified and print out their calculated values. Usage:

        PeerProfile [filename]*