[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 09 of 12] xenalyze: Sort cr3 enumerated values by start time



Add a new sort method to sort by start time, rather than by total
time, and make it the default.

Really should make it command-line switchable, but I'll leave that
improvement until later.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 3c6da152c844 -r 46c366d71c74 xenalyze.c
--- a/xenalyze.c        Mon Nov 28 16:16:23 2011 +0000
+++ b/xenalyze.c        Mon Nov 28 16:16:23 2011 +0000
@@ -4144,7 +4144,7 @@ void cr3_dump_list(struct cr3_value_stru
     struct cr3_value_struct **qsort_array;
     int i, N=0;
 
-    int cr3_compare(const void *_a, const void *_b) {
+    int cr3_compare_total(const void *_a, const void *_b) {
         struct cr3_value_struct *a=*(typeof(&a))_a;
         struct cr3_value_struct *b=*(typeof(&a))_b;
 
@@ -4161,6 +4161,18 @@ void cr3_dump_list(struct cr3_value_stru
             return -1;
     }
 
+    int cr3_compare_start(const void *_a, const void *_b) {
+        struct cr3_value_struct *a=*(typeof(&a))_a;
+        struct cr3_value_struct *b=*(typeof(&a))_b;
+
+        if(a->first_time > b->first_time)
+            return 1;
+        else if(b->first_time == a->first_time)
+            return 0;
+        else
+            return -1;
+    }
+
     if(!head)
         return;
 
@@ -4180,7 +4192,7 @@ void cr3_dump_list(struct cr3_value_stru
 
     /* Sort the array by time */
     qsort(qsort_array, N, sizeof(struct eip_list_struct *),
-          cr3_compare);
+          cr3_compare_start);
 
     /* WARNING: don't use N after this point unless you copy this variable */
 #if 0

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.