From de8fa40209300a92a595be59073a2f0cb258e15b Mon Sep 17 00:00:00 2001 From: Monty Brandenberg Date: Wed, 15 Dec 2010 15:50:09 -0500 Subject: ESC-235 Truncation of over-sized metrics reports wasn't working. Legacy of the LLSD::Map-to-LLSD::Array conversion, this ended up performing an erase on the array rather than the map taking out all the regions. So, there *was* a metrics report, it was just empty of regions. Fixed and scanned for more array/map problems and corrected the data type for duration sorts (should have been Real). --- indra/newview/lltexturefetch.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index e13fcf027f..25ad2fe717 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2974,25 +2974,27 @@ truncate_viewer_metrics(int max_regions, LLSD & metrics) } // Build map of region hashes ordered by duration - typedef std::multimap reg_ordered_list_t; + typedef std::multimap reg_ordered_list_t; reg_ordered_list_t regions_by_duration; - LLSD::map_const_iterator it_end(reg_map.endMap()); - for (LLSD::map_const_iterator it(reg_map.beginMap()); it_end != it; ++it) + int ind(0); + LLSD::array_const_iterator it_end(reg_map.endArray()); + for (LLSD::array_const_iterator it(reg_map.beginArray()); it_end != it; ++it, ++ind) { - LLSD::Integer duration = (it->second)[duration_tag].asInteger(); - regions_by_duration.insert(reg_ordered_list_t::value_type(duration, it->first)); + LLSD::Real duration = (*it)[duration_tag].asReal(); + regions_by_duration.insert(reg_ordered_list_t::value_type(duration, ind)); } - // Erase excess region reports selecting shortest duration first - reg_ordered_list_t::const_iterator it2_end(regions_by_duration.end()); - reg_ordered_list_t::const_iterator it2(regions_by_duration.begin()); - int limit(regions_by_duration.size() - max_regions); - for (int i(0); i < limit && it2_end != it2; ++i, ++it2) + // Build a replacement regions array with the longest-persistence regions + LLSD new_region(LLSD::emptyArray()); + reg_ordered_list_t::const_reverse_iterator it2_end(regions_by_duration.rend()); + reg_ordered_list_t::const_reverse_iterator it2(regions_by_duration.rbegin()); + for (int i(0); i < max_regions && it2_end != it2; ++i, ++it2) { - reg_map.erase(it2->second); + new_region.append(reg_map[it2->second]); } - + reg_map = new_region; + return true; } -- cgit v1.2.3