Skip to contentSkip to conversation

xenalyze: Make eip_list output more useful

PATCH New George Dunlap 1 participant 1 message Nov 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenalyze: Make eip_list output more useful

# HG changeset patch
# User George Dunlap <[email protected]> # Date 1352307402 0
# Node ID 71eeac989efca6a590051edc3dd132df1bd55f7b # Parent 2080678babbfd5234536af913a768a7f18cca690
xenalyze: Make eip_list output more useful

1. Count the total number of samples
2. If the samples don't have associated cycle data, print the percentage of samples of the total
3. Use 12 characters, so 64-bit addresses are aligned properly.

xenalyze.c +21 -3
@@ -2962,6 +2962,7 @@ void update_eip(struct eip_list_struct *
 void dump_eip(struct eip_list_struct *head) {
     struct eip_list_struct *p;
     int i;
+    int total = 0;
 
     struct eip_list_struct **qsort_array;
     int N=0;
@@ -2984,7 +2985,10 @@ void dump_eip(struct eip_list_struct *he
     }
 
     for(p=head; p; p=p->next)
+    {
+        total += p->summary.count;
         N++;
+    }
 
     if(!N)
         return;
@@ -3003,11 +3007,25 @@ void dump_eip(struct eip_list_struct *he
         N=opt.summary_eip_limit;
 #endif
 
+    printf("   Total samples: %d\n", total);
+    
     for(i=0; i<N; i++) {
         p = qsort_array[i];
-        PRINT_SUMMARY(p->summary, "   %8llx%-45s: ",
-                      p->eip,
-                      find_symbol(p->eip));
+        if ( p->summary.cycles )
+            PRINT_SUMMARY(p->summary, "   %12llx%-45s: ",
+                          p->eip,
+                          find_symbol(p->eip));
+        else
+        {
+            printf("   %12llx%-45s: ",
+                          p->eip,
+                          find_symbol(p->eip));
+            printf(" %7d %5.2lf%%\n",
+                   p->summary.count,
+                   ((double)p->summary.count*100)/total);
+        }
+
+            
         if(eip_list_type[p->type].dump) {
             eip_list_type[p->type].dump(p);
         }