]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Profiler: fix report sorting algorithm
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Jan 2011 02:23:48 +0000 (15:23 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Jan 2011 02:23:48 +0000 (15:23 +1300)
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.

src/ProfStats.cc

index fa671cf9a0996c5a167c0daa6d5c7b5994c366a9..6a311dcff069c31b438723be845ec99e153d67e9 100644 (file)
@@ -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;