mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-24 11:12:18 +00:00
Added a method to get the number of failed content lookups
This commit is contained in:
parent
42da6df375
commit
a25b88a9bb
@ -61,6 +61,11 @@ public interface KadStatistician
|
||||
*/
|
||||
public int numContentLookups();
|
||||
|
||||
/**
|
||||
* @return How many content lookups have failed.
|
||||
*/
|
||||
public int numFailedContentLookups();
|
||||
|
||||
/**
|
||||
* @return The total time spent on content lookups.
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ public class Statistician implements KadStatistician
|
||||
private long bootstrapTime;
|
||||
|
||||
/* Content lookup operation timing & route length */
|
||||
private int numContentLookups;
|
||||
private int numContentLookups, numFailedContentLookups;
|
||||
private long totalContentLookupTime;
|
||||
private long totalRouteLength;
|
||||
|
||||
@ -76,9 +76,16 @@ public class Statistician implements KadStatistician
|
||||
@Override
|
||||
public void addContentLookup(long time, int routeLength, boolean isSuccessful)
|
||||
{
|
||||
this.numContentLookups++;
|
||||
this.totalContentLookupTime += time;
|
||||
this.totalRouteLength += routeLength;
|
||||
if (isSuccessful)
|
||||
{
|
||||
this.numContentLookups++;
|
||||
this.totalContentLookupTime += time;
|
||||
this.totalRouteLength += routeLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.numFailedContentLookups++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,6 +94,12 @@ public class Statistician implements KadStatistician
|
||||
return this.numContentLookups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int numFailedContentLookups()
|
||||
{
|
||||
return this.numFailedContentLookups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long totalContentLookupTime()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user