Include the longest elapsed time in the profile (not too useful if you profile
from the beginning, but useful if you clear the profiles in order to record over a brief interval). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6546 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -716,7 +716,7 @@ public class PresentsDObjectMgr
|
|||||||
if (uprof == null) {
|
if (uprof == null) {
|
||||||
_profiles.put(cname, uprof = new UnitProfile());
|
_profiles.put(cname, uprof = new UnitProfile());
|
||||||
}
|
}
|
||||||
uprof.record(start, elapsed);
|
uprof.record(elapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1030,10 +1030,11 @@ public class PresentsDObjectMgr
|
|||||||
* enabled. */
|
* enabled. */
|
||||||
protected static class UnitProfile
|
protected static class UnitProfile
|
||||||
{
|
{
|
||||||
public void record (long start, long elapsed)
|
public void record (long elapsed)
|
||||||
{
|
{
|
||||||
_totalElapsed += elapsed;
|
_totalElapsed += elapsed;
|
||||||
_histo.addValue((int)elapsed);
|
_histo.addValue((int)elapsed);
|
||||||
|
_longest = Math.max(elapsed, _longest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1041,10 +1042,10 @@ public class PresentsDObjectMgr
|
|||||||
{
|
{
|
||||||
int count = _histo.size();
|
int count = _histo.size();
|
||||||
return _totalElapsed + "us/" + count + " = " + (_totalElapsed/count) + "us avg " +
|
return _totalElapsed + "us/" + count + " = " + (_totalElapsed/count) + "us avg " +
|
||||||
StringUtil.toString(_histo.getBuckets());
|
StringUtil.toString(_histo.getBuckets() + " " + _longest + "us longest");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long _totalElapsed;
|
protected long _totalElapsed, _longest;
|
||||||
protected Histogram _histo = new Histogram(0, 20000, 10);
|
protected Histogram _histo = new Histogram(0, 20000, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user