* Method getStats.
* @return StrTable
*/
public static StrTable getStats()
{
StrTable table = new StrTable("PathFind Buffers Stats");
lock.lock();
try
{
long totalUses = 0, totalPlayable = 0, totalTime = 0;
int index = 0;
int count;
long uses;
long playable;
long itrs;
long success;
long overtime;
long time;
for (int size : sizes)
{
index++;
count = 0;
uses = 0;
playable = 0;
itrs = 0;
success = 0;
overtime = 0;
time = 0;
for (PathFindBuffer buff : buffers.get(size))
{
count++;
uses += buff.totalUses;
playable += buff.playableUses;
success += buff.successUses;
overtime += buff.overtimeUses;
time += buff.totalTime / 1000000;
itrs += buff.totalItr;
}
totalUses += uses;
totalPlayable += playable;
totalTime += time;
table.set(index, "Size", size);
table.set(index, "Count", count);
table.set(index, "Uses (success%)", uses + "(" + String.format("%2.2f", (uses > 0) ? (success * 100.) / uses : 0) + "%)");
table.set(index, "Uses, playble", playable + "(" + String.format("%2.2f", (uses > 0) ? (playable * 100.) / uses : 0) + "%)");
table.set(index, "Uses, overtime", overtime + "(" + String.format("%2.2f", (uses > 0) ? (overtime * 100.) / uses : 0) + "%)");
table.set(index, "Iter., avg", (uses > 0) ? itrs / uses : 0);
table.set(index, "Time, avg (ms)", String.format("%1.3f", (uses > 0) ? (double) time / uses : 0.));
}
table.addTitle("Uses, total / playable : " + totalUses + " / " + totalPlayable);
table.addTitle("Uses, total time / avg (ms) : " + totalTime + " / " + String.format("%1.3f", totalUses > 0 ? (double) totalTime / totalUses : 0));
}
finally
{
lock.unlock();
}