WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xenperf hypercall pretty print

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xenperf hypercall pretty print
From: Yoshihiko Yaegashi <y.yaegashi@xxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 13:22:57 +0900
Delivery-date: Thu, 02 Nov 2006 13:32:34 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)
Hi,

This patch implements a pretty print feature to the hypercall counters.
I added an option -p so it would be easier to see how many times each
hypercall was called.
The function of option -f is left untouched.
The result is as the attachment.

Reference:
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg01324.html

Signed-off-by: Yoshihiko Yaegashi <y.yaegashi@xxxxxxxxxxxxxx>
Signed-off-by: Ken Hironaka <kenny@xxxxxxxxxxxxxxxxxxxxxxxx>

Thanks,
Yaegashi
diff -r b21246720fde -r 986fd62fbfda tools/misc/xenperf.c
--- a/tools/misc/xenperf.c      Mon Oct 30 17:35:11 2006 +0000
+++ b/tools/misc/xenperf.c      Wed Nov 01 14:47:25 2006 +0900
@@ -10,7 +10,6 @@
  * Description: 
  */
 
-
 #include <xenctrl.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -18,6 +17,75 @@
 #include <errno.h>
 #include <string.h>
 
+const char* hypercall_name_table[64]=
+{
+    [__HYPERVISOR_set_trap_table] = "set_trap_table",                          
  /*0*/
+    [__HYPERVISOR_mmu_update] = "mmu_update",                                  
  /*1*/
+    [__HYPERVISOR_set_gdt] = "set_gdt",                                        
  /*2*/
+    [__HYPERVISOR_stack_switch] = "stack_switch",                              
  /*3*/
+    [__HYPERVISOR_set_callbacks] = "set_callbacks",                            
  /*4*/
+    [__HYPERVISOR_fpu_taskswitch] = "fpu_taskswitch",                          
  /*5*/
+    [__HYPERVISOR_sched_op_compat] = "sched_op_compat",                        
  /*6*/
+    [__HYPERVISOR_platform_op] = "platform_op",                                
  /*7*/
+    [__HYPERVISOR_set_debugreg] = "set_debugreg",                              
  /*8*/
+    [__HYPERVISOR_get_debugreg] = "get_debugreg",                              
  /*9*/
+    [__HYPERVISOR_update_descriptor] = "update_descriptor",                    
  /*10*/
+    [11] = "NULL",                                                             
  /*11*/
+    [__HYPERVISOR_memory_op] = "memory_op",                                    
  /*12*/
+    [__HYPERVISOR_multicall] = "multicall",                                    
  /*13*/
+    [__HYPERVISOR_update_va_mapping] = "update_va_mapping",                    
  /*14*/
+    [__HYPERVISOR_set_timer_op] = "set_timer_op",                              
  /*15*/
+    [__HYPERVISOR_event_channel_op_compat] = "event_channel_op_compat",        
  /*16 compat since 0x00030202 */
+    [__HYPERVISOR_xen_version] = "xen_version",                                
  /*17*/
+    [__HYPERVISOR_console_io] = "console_io",                                  
  /*18*/
+    [__HYPERVISOR_physdev_op_compat] = "physdev_op_compat",                    
  /*19  compat since 0x00030202 */
+    [__HYPERVISOR_grant_table_op] = "grant_table_op",                          
  /*20*/
+    [__HYPERVISOR_vm_assist] = "vm_assist",                                    
  /*21*/
+    [__HYPERVISOR_update_va_mapping_otherdomain] = 
"update_va_mapping_otherdomain", /*22*/
+    [__HYPERVISOR_iret] = "iret",                                              
  /*23  x86 only */
+    [__HYPERVISOR_vcpu_op] = "vcpu_op",                                        
  /*24*/
+    [__HYPERVISOR_set_segment_base] = "set_segment_base",                      
  /*25  x86/64 only */
+    [__HYPERVISOR_mmuext_op] = "mmuext_op",                                    
  /*26*/
+    [__HYPERVISOR_acm_op] = "acm_op",                                          
  /*27*/
+    [__HYPERVISOR_nmi_op] = "nmi_op",                                          
  /*28*/
+    [__HYPERVISOR_sched_op] = "sched_op",                                      
  /*29*/
+    [__HYPERVISOR_callback_op] = "callback_op",                                
  /*30*/
+    [__HYPERVISOR_xenoprof_op] = "xenoprof_op",                                
  /*31*/
+    [__HYPERVISOR_event_channel_op] = "event_channel_op",                      
  /*32*/
+    [__HYPERVISOR_physdev_op] = "physdev_op",                                  
  /*33*/
+    [__HYPERVISOR_hvm_op] = "hvm_op",                                          
  /*34*/
+    [35] = "NULL",                                                             
  /*35*/
+    [36] = "NULL",                                                             
  /*36*/
+    [37] = "NULL",                                                             
  /*37*/
+    [38] = "NULL",                                                             
  /*38*/
+    [39] = "NULL",                                                             
  /*39*/
+    [40] = "NULL",                                                             
  /*40*/
+    [41] = "NULL",                                                             
  /*41*/
+    [42] = "NULL",                                                             
  /*42*/
+    [43] = "NULL",                                                             
  /*43*/
+    [44] = "NULL",                                                             
  /*44*/
+    [45] = "NULL",                                                             
  /*45*/
+    [46] = "NULL",                                                             
  /*46*/
+    [47] = "NULL",                                                             
  /*47*/
+/* Architecture-specific hypercall definitions. */
+    [__HYPERVISOR_arch_0] = "arch_0",                                          
  /*48*/
+    [__HYPERVISOR_arch_1] = "arch_1",                                          
  /*49*/
+    [__HYPERVISOR_arch_2] = "arch_2",                                          
  /*50*/
+    [__HYPERVISOR_arch_3] = "arch_3",                                          
  /*51*/
+    [__HYPERVISOR_arch_4] = "arch_4",                                          
  /*52*/
+    [__HYPERVISOR_arch_5] = "arch_5",                                          
  /*53*/
+    [__HYPERVISOR_arch_6] = "arch_6",                                          
  /*54*/
+    [__HYPERVISOR_arch_7] = "arch_7",                                          
  /*55*/
+    [56] = "NULL",                                                             
  /*56*/
+    [57] = "NULL",                                                             
  /*57*/
+    [58] = "NULL",                                                             
  /*58*/
+    [59] = "NULL",                                                             
  /*59*/
+    [60] = "NULL",                                                             
  /*60*/
+    [61] = "NULL",                                                             
  /*61*/
+    [62] = "NULL",                                                             
  /*62*/
+    [63] = "NULL"                                                              
  /*63*/
+};
+
 int lock_pages(void *addr, size_t len)
 {
     int e = 0;
@@ -41,7 +109,8 @@ int main(int argc, char *argv[])
        xc_perfc_val_t  *pcv;
        xc_perfc_val_t  *val;
        int num_desc, num_val;
-    unsigned int    sum, reset = 0, full = 0;
+    unsigned int    sum, reset = 0, full = 0, pretty = 0;
+    char hypercall_name[36];
 
     if ( argc > 1 )
     {
@@ -52,6 +121,10 @@ int main(int argc, char *argv[])
             {
             case 'f':
                 full = 1;
+                break;
+            case 'p':
+                full = 1;
+                pretty = 1;
                 break;
             case 'r':
                 reset = 1;
@@ -66,6 +139,7 @@ int main(int argc, char *argv[])
             printf("%s: [-r]\n", argv[0]);
             printf("no args: print digested counters\n");
             printf("    -f : print full arrays/histograms\n");
+            printf("    -p : print full arrays/histograms in pretty format\n");
             printf("    -r : reset counters\n");
             return 0;
         }
@@ -134,11 +208,31 @@ int main(int argc, char *argv[])
         printf ("T=%10u ", (unsigned int)sum);
 
         if ( full || (pcd[i].nr_vals <= 4) )
-            for ( j = 0; j < pcd[i].nr_vals; j++ )
-                printf(" %10u", (unsigned int)val[j]);
-
-        printf("\n");
-               val += pcd[i].nr_vals;
+        {
+            if ( pretty && (strcmp(pcd[i].name, "hypercalls") == 0) )
+            {
+                printf("\n");
+                for( j = 0; j < pcd[i].nr_vals; j++ )
+                {
+                    strncpy(hypercall_name, hypercall_name_table[j], 35);
+                    hypercall_name[35]='\0';
+                    printf("%-35s ", hypercall_name);
+                    printf("%12u\n", (unsigned int)val[j]);
+                }
+            }
+            else
+            {
+                for ( j = 0; j < pcd[i].nr_vals; j++ )
+                    printf(" %10u", (unsigned int)val[j]);
+                printf("\n");
+            }
+        }
+        else
+        {
+            printf("\n");
+        }
+
+        val += pcd[i].nr_vals;
     }
 
     return 0;
exceptions                          T=      3979           0          0         
 0          0          0          0          0         47          0          0 
         0          0          0       3450        482          0          0    
      0          0          0          0          0          0          0       
   0          0          0          0          0          0          0          0
vmexits                             T=         0           0          0         
 0          0          0          0          0          0          0          0 
         0          0          0          0          0          0          0    
      0          0          0          0          0          0          0       
   0          0          0          0          0          0          0          
0          0          0          0          0          0          0          0  
        0          0          0          0          0
cause vector                        T=         0           0          0         
 0          0          0          0          0          0          0          0 
         0          0          0          0          0          0          0    
      0          0          0          0          0          0          0       
   0          0          0          0          0          0          0          0
SVMexits                            T=         0           0          0         
 0          0          0          0          0          0          0          0 
         0          0          0          0          0          0          0    
      0          0          0          0          0          0          0       
   0          0          0          0          0          0          0          
0          0          0          0          0          0          0          0  
        0          0          0          0          0          0          0     
     0          0          0          0          0          0          0        
  0          0          0          0          0          0          0          
0          0          0          0          0          0          0          0  
        0          0          0          0          0          0          0     
     0          0          0          0          0          0          0        
  0          0          0          0          0          0          0          
0          0          0          0          0          0          0          0  
        0          0          0          0          0          0          0     
     0          0          0          0          0          0          0        
  0          0          0          0          0          0          0          
0          0          0          0          0          0          0          0  
        0          0          0          0          0          0          0     
     0          0          0          0
segmentation fixups                 T=      3282        1916        144        
908        314
apic timer interrupts               T=      3517         863        921        
875        858
domain page tlb flushes             T=         0           0          0         
 0          0
calls_to_mmu_update                 T=        17           0          4         
 4          9
num_page_updates                    T=        17           0          4         
 4          9
calls_to_update_va_map              T=       548           6        188        
188        166
page faults                         T=       482           4        105        
137        236
copy_user faults                    T=         2           0          0         
 0          2
map_domain_page count               T=       965         431        126        
163        245
writable pt emulations              T=       177           2          6         
31        138
pre-exception fixed                 T=         0           0          0         
 0          0
calls to shadow_alloc               T=         0           0          0         
 0          0
shadow_alloc flushed TLBs           T=         0           0          0         
 0          0
number of shadow pages in use       T=         0           0
calls to shadow_free                T=         0           0          0         
 0          0
shadow recycles old shadows         T=         0           0          0         
 0          0
shadow recycles in-use shadows      T=         0           0          0         
 0          0
shadow hit read-only linear map     T=         0           0          0         
 0          0
shadow A bit update                 T=         0           0          0         
 0          0
shadow A&D bit update               T=         0           0          0         
 0          0
calls to shadow_fault               T=         0           0          0         
 0          0
shadow_fault guest bad gfn          T=         0           0          0         
 0          0
shadow_fault guest not-present      T=         0           0          0         
 0          0
shadow_fault guest NX fault         T=         0           0          0         
 0          0
shadow_fault guest R/W fault        T=         0           0          0         
 0          0
shadow_fault guest U/S fault        T=         0           0          0         
 0          0
shadow_fault emulates a read        T=         0           0          0         
 0          0
shadow_fault emulates a write       T=         0           0          0         
 0          0
shadow_fault emulator fails         T=         0           0          0         
 0          0
shadow_fault handled as mmio        T=         0           0          0         
 0          0
shadow_fault fixed fault            T=         0           0          0         
 0          0
shadow causes ptwr to emulate       T=         0           0          0         
 0          0
calls to shadow_validate_gl1e       T=         0           0          0         
 0          0
calls to shadow_validate_gl2e       T=         0           0          0         
 0          0
calls to shadow_validate_gl3e       T=         0           0          0         
 0          0
calls to shadow_validate_gl4e       T=         0           0          0         
 0          0
calls to shadow_hash_lookup         T=         0           0          0         
 0          0
shadow hash hit in bucket head      T=         0           0          0         
 0          0
shadow hash misses                  T=         0           0          0         
 0          0
calls to get_shadow_status          T=         0           0          0         
 0          0
calls to shadow_hash_insert         T=         0           0          0         
 0          0
calls to shadow_hash_delete         T=         0           0          0         
 0          0
shadow removes write access         T=         0           0          0         
 0          0
shadow writeable: 32b w2k3          T=         0           0          0         
 0          0
shadow writeable: 32pae w2k3        T=         0           0          0         
 0          0
shadow writeable: 64b w2k3          T=         0           0          0         
 0          0
shadow writeable: 32b linux low     T=         0           0          0         
 0          0
shadow writeable: 32b linux high    T=         0           0          0         
 0          0
shadow writeable brute-force        T=         0           0          0         
 0          0
shadow removes all mappings         T=         0           0          0         
 0          0
shadow rm-mappings brute-force      T=         0           0          0         
 0          0
shadow unshadows for fork/exit      T=         0           0          0         
 0          0
shadow unshadows a page             T=         0           0          0         
 0          0
shadow unshadow by up-pointer       T=         0           0          0         
 0          0
shadow unshadow brute-force         T=         0           0          0         
 0          0
shadow_get_page_from_l1e failed     T=         0           0          0         
 0          0
shadow walks guest tables           T=         0           0          0         
 0          0
shadow emulates invlpg              T=         0           0          0         
 0          0
shadow invlpg faults                T=         0           0          0         
 0          0
hypercalls                          T=      3295 
set_trap_table                                 0
mmu_update                                    17
set_gdt                                        0
stack_switch                                   0
set_callbacks                                  0
fpu_taskswitch                                 0
sched_op_compat                                0
platform_op                                    0
set_debugreg                                   0
get_debugreg                                   0
update_descriptor                              3
NULL                                           0
memory_op                                      0
multicall                                    845
update_va_mapping                            548
set_timer_op                                 696
event_channel_op_compat                        0
xen_version                                    0
console_io                                     0
physdev_op_compat                              0
grant_table_op                                 0
vm_assist                                      0
update_va_mapping_otherdomain                  0
iret                                           0
vcpu_op                                        0
set_segment_base                               0
mmuext_op                                    305
acm_op                                         0
nmi_op                                         0
sched_op                                     696
callback_op                                    0
xenoprof_op                                    0
event_channel_op                              84
physdev_op                                    99
hvm_op                                         0
NULL                                           2
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
arch_0                                         0
arch_1                                         0
arch_2                                         0
arch_3                                         0
arch_4                                         0
arch_5                                         0
arch_6                                         0
arch_7                                         0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
NULL                                           0
#interrupts                         T=       942         942          0         
 0          0
#IPIs                               T=       107          61          2         
25         19
sched: timer                        T=       870         137        248        
233        252
sched: runs through scheduler       T=      2192         947        392        
462        391
sched: context switches             T=      1388         840        164        
237        147
PG_need_flush tlb flushes           T=         8           0          1         
 1          6
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>