Get the expected size from the cache as a map, and avoid the casting.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6711 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -27,7 +27,6 @@ import com.google.common.cache.Cache;
|
|||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.primitives.Ints;
|
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
@@ -126,9 +125,9 @@ public class MethodProfiler
|
|||||||
*/
|
*/
|
||||||
public Map<String, Result> getResults ()
|
public Map<String, Result> getResults ()
|
||||||
{
|
{
|
||||||
Map<String, Result> results = Maps.newHashMapWithExpectedSize(
|
Map<String, RunningStats> cmap = _profiles.asMap();
|
||||||
Ints.saturatedCast(_profiles.size()));
|
Map<String, Result> results = Maps.newHashMapWithExpectedSize(cmap.size());
|
||||||
for (Map.Entry<String, RunningStats> entry : _profiles.asMap().entrySet()) {
|
for (Map.Entry<String, RunningStats> entry : cmap.entrySet()) {
|
||||||
synchronized (entry.getValue()) {
|
synchronized (entry.getValue()) {
|
||||||
results.put(entry.getKey(), toResult(entry.getValue()));
|
results.put(entry.getKey(), toResult(entry.getValue()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user