Report our max and min when we compute a bogus bucket index.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@802 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -83,7 +83,6 @@ public class Percentiler
|
|||||||
if (_max < _min) {
|
if (_max < _min) {
|
||||||
log.warning("Percentiler initialized with bogus range. Coping.",
|
log.warning("Percentiler initialized with bogus range. Coping.",
|
||||||
"min", _min, "max", _max);
|
"min", _min, "max", _max);
|
||||||
|
|
||||||
_max = _min + 1;
|
_max = _min + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,17 +124,13 @@ public class Percentiler
|
|||||||
int newmax = (value > _max) ? (_min + (int)Math.ceil((value - _min) * 1.2f)) : _max;
|
int newmax = (value > _max) ? (_min + (int)Math.ceil((value - _min) * 1.2f)) : _max;
|
||||||
|
|
||||||
if (newmin > _min || newmax < _max) {
|
if (newmin > _min || newmax < _max) {
|
||||||
log.warning("Grew our range in crazy ways?!",
|
log.warning("Grew our range in crazy ways?!", "value", value, "total", _total,
|
||||||
"value", value, "total", _total,
|
"new", ("" + newmin + ":" + newmax), "old", ("" + _min + ":" + _max));
|
||||||
"new", ("" + newmin + ":" + newmax),
|
|
||||||
"old", ("" + _min + ":" + _max));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logNewMax) {
|
if (logNewMax) {
|
||||||
log.info("Resizing",
|
log.info("Resizing", "value", value, "total", _total,
|
||||||
"value", value, "total", _total,
|
"new", ("" + newmin + ":" + newmax), "old", ("" + _min + ":" + _max));
|
||||||
"new", ("" + newmin + ":" + newmax),
|
|
||||||
"old", ("" + _min + ":" + _max));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new counts array and map the old array to the new
|
// create a new counts array and map the old array to the new
|
||||||
@@ -411,7 +406,8 @@ public class Percentiler
|
|||||||
int idx = Math.round((value - _min) * BUCKET_COUNT / (_max - _min));
|
int idx = Math.round((value - _min) * BUCKET_COUNT / (_max - _min));
|
||||||
idx = Math.min(idx, BUCKET_COUNT-1);
|
idx = Math.min(idx, BUCKET_COUNT-1);
|
||||||
if (idx < 0 || idx >= BUCKET_COUNT) {
|
if (idx < 0 || idx >= BUCKET_COUNT) {
|
||||||
log.warning("Bogus bucket index, using 0", "value", value, "idx", idx, new Throwable());
|
log.warning("Bogus bucket index, using 0", "value", value, "max", _max, "min", _min,
|
||||||
|
"idx", idx, new Throwable());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return idx;
|
return idx;
|
||||||
|
|||||||
Reference in New Issue
Block a user