From: Amos Jeffries Date: Sat, 29 Jan 2011 02:23:48 +0000 (+1300) Subject: Profiler: fix report sorting algorithm X-Git-Tag: take03^2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e6e2c8a9b7fdf7ae5eae41e775a677f697e2051;p=thirdparty%2Fsquid.git Profiler: fix report sorting algorithm The sorting was performed in a way to exclude the UNACCOUNTED and leave it first in the display list. However with the new auto-genenerated enum all other entries are at indeterminate locations. Using hash_lookup resulted in only half teh list being sorted. Fix that by referencing from UNACCOUNTED which is guaranteed to be first. --- diff --git a/src/ProfStats.cc b/src/ProfStats.cc index fa671cf9a0..6a311dcff0 100644 --- a/src/ProfStats.cc +++ b/src/ProfStats.cc @@ -100,13 +100,11 @@ xprof_comp(xprof_stats_node ** ii, xprof_stats_node ** jj) static void xprof_sorthist(TimersArray * xprof_list) { - int i; - - for (i = 0; i < XPROF_LAST; i++) { + for (int i = 0; i < XPROF_LAST; i++) { sortlist[i] = xprof_list[i]; } - qsort(&sortlist[XPROF_hash_lookup], XPROF_LAST - XPROF_hash_lookup, sizeof(xprof_stats_node *), (QS *) xprof_comp); + qsort(&sortlist[XPROF_PROF_UNACCOUNTED+1], XPROF_LAST - XPROF_PROF_UNACCOUNTED+1, sizeof(xprof_stats_node *), (QS *) xprof_comp); } static double time_frame;