|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.HorizonCounter
Horizon statistics. We measure the horizon by looking at all ping replies coming per connection--regardless whether they are in response to pings originating from us. To avoid double-counting ping replies, we keep a set of Endpoint's around, bounded in size to save memory. This scheme is robust in the face of pong throttling. Note however that we cannot discern pings from multiple hosts with the same private address. But you are probably not interested in such hosts anyway. The problem with this scheme is that the numbers tend to grow without bound, even if hosts leave the network. Ideally we'd like to clear all pongs that are more than HORIZON_UPDATE_TIME milliseconds old, but that's difficult to implement efficiently. As a simplication, we periodically clear the set of pongs every HORIZON_UPDATE_TIME milliseconds (by calling updateHorizonStats) and start recounting. While we are recounting, we return the last size of the set. So pongs in the set are HORIZON_UPDATE_TIME to 2*HORIZON_UPDATE_TIME milliseconds old. LOCKING: obtain this' monitor
Constructor Summary | |
HorizonCounter()
|
Method Summary | |
void |
addPong(PingReply pong)
|
long |
getNumFiles()
Returns the number of files reachable from me. |
long |
getNumHosts()
Returns the number of hosts reachable from me. |
long |
getTotalFileSize()
Returns the size of all files reachable from me. |
static HorizonCounter |
instance()
|
void |
refresh()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HorizonCounter()
Method Detail |
public static HorizonCounter instance()
public void addPong(PingReply pong)
public void refresh()
public long getNumHosts()
public long getNumFiles()
public long getTotalFileSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |