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();
|
public int numContentLookups();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return How many content lookups have failed.
|
||||||
|
*/
|
||||||
|
public int numFailedContentLookups();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The total time spent on content lookups.
|
* @return The total time spent on content lookups.
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +21,7 @@ public class Statistician implements KadStatistician
|
|||||||
private long bootstrapTime;
|
private long bootstrapTime;
|
||||||
|
|
||||||
/* Content lookup operation timing & route length */
|
/* Content lookup operation timing & route length */
|
||||||
private int numContentLookups;
|
private int numContentLookups, numFailedContentLookups;
|
||||||
private long totalContentLookupTime;
|
private long totalContentLookupTime;
|
||||||
private long totalRouteLength;
|
private long totalRouteLength;
|
||||||
|
|
||||||
@ -76,9 +76,16 @@ public class Statistician implements KadStatistician
|
|||||||
@Override
|
@Override
|
||||||
public void addContentLookup(long time, int routeLength, boolean isSuccessful)
|
public void addContentLookup(long time, int routeLength, boolean isSuccessful)
|
||||||
{
|
{
|
||||||
this.numContentLookups++;
|
if (isSuccessful)
|
||||||
this.totalContentLookupTime += time;
|
{
|
||||||
this.totalRouteLength += routeLength;
|
this.numContentLookups++;
|
||||||
|
this.totalContentLookupTime += time;
|
||||||
|
this.totalRouteLength += routeLength;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.numFailedContentLookups++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -87,6 +94,12 @@ public class Statistician implements KadStatistician
|
|||||||
return this.numContentLookups;
|
return this.numContentLookups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int numFailedContentLookups()
|
||||||
|
{
|
||||||
|
return this.numFailedContentLookups;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long totalContentLookupTime()
|
public long totalContentLookupTime()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user