In the content lookup statistics - added a value "isContentFound" to be passed

This commit is contained in:
Joshua Kissoon 2014-05-12 23:41:45 +05:30
parent fca4a5fde5
commit 42da6df375
4 changed files with 14 additions and 5 deletions

View File

@ -50,10 +50,11 @@ public interface KadStatistician
/**
* Add the timing for a new content lookup operation that took place
*
* @param time The time the content lookup took in nanoseconds
* @param routeLength The length of the route it took to get the content
* @param time The time the content lookup took in nanoseconds
* @param routeLength The length of the route it took to get the content
* @param isSuccessful Whether the content lookup was successful or not
*/
public void addContentLookup(long time, int routeLength);
public void addContentLookup(long time, int routeLength, boolean isSuccessful);
/**
* @return The total number of content lookups performed.

View File

@ -347,7 +347,7 @@ public class KademliaNode
ContentLookupOperation clo = new ContentLookupOperation(server, this, param, this.config);
clo.execute();
long endTime = System.nanoTime();
this.statistician.addContentLookup(endTime - startTime, clo.routeLength());
this.statistician.addContentLookup(endTime - startTime, clo.routeLength(), clo.isContentFound());
return clo.getContentFound();
}

View File

@ -74,7 +74,7 @@ public class Statistician implements KadStatistician
}
@Override
public void addContentLookup(long time, int routeLength)
public void addContentLookup(long time, int routeLength, boolean isSuccessful)
{
this.numContentLookups++;
this.totalContentLookupTime += time;

View File

@ -307,6 +307,14 @@ public class ContentLookupOperation implements Operation, Receiver
this.askNodesorFinish();
}
/**
* @return Whether the content was found or not.
*/
public boolean isContentFound()
{
return this.isContentFound;
}
/**
* @return The list of all content found during the lookup operation
*