xenperf hypercall pretty print
RFC PATCH 1/1 xenperf hypercall pretty print
this patch pretty prints the hypercall section for
$xenperf -f
previously, xenperf -f simply listed counts for all hyper calls. I added a hypercall index to this so it will be easier to tell which hypercall was called how many times. this is an architecture independent patch.
tools/misc/xenperf.c +77 -2
@@ -10,13 +10,81 @@* Description: */ -#include <xenctrl.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <errno.h> #include <string.h> + +const char * hypercall_name_table[64 ]= +{ +"set_trap_table" ,//0 +"mmu_update" ,//1 +"set_gdt" ,//2 +"stack_switch" ,//3 +"set_callbacks" ,//4 +"fpu_taskswitch" ,//5 +"sched_op_compat" ,//6 +"dom0_op" ,//7 +"set_debugreg" ,//8 +"get_debugreg" ,//9 +"update_descriptor" ,//10 +"NULL" ,//11 +"memory_op" ,//12 +"multicall" ,//13 +"update_va_mapping" ,//14 +"set_timer_op" ,//15 +"event_channel_op_compat" ,// 16 /* compat since 0x00030202 */ +"xen_version" ,//17 +"console_io" ,//18 +"physdev_op_compat" ,//19 /* compat since 0x00030202 */ +"grant_table_op" ,//20 +"vm_assist" ,//21 +"update_va_mapping_otherdomain" ,//22 +"iret" ,//23 /* x86 only */ +"vcpu_op" ,//24 +"set_segment_base" ,//25 /* x86/64 only */ +"mmuext_op" ,//26 +"acm_op" ,//27 +"nmi_op" ,//28 +"sched_op" ,//29 +"callback_op" ,//30 +"xenoprof_op" ,//31 +"event_channel_op" ,//32 +"physdev_op" ,//33 +"hvm_op" ,//34 +"NULL" ,//35 +"NULL" ,//36 +"NULL" ,//37 +"NULL" ,//38 +"NULL" ,//39 +"NULL" ,//40 +"NULL" ,//41 +"NULL" ,//42 +"NULL" ,//43 +"NULL" ,//44 +"NULL" ,//45 +"NULL" ,//46 +"NULL" ,//47 +/* Architecture-specific hypercall definitions. */ +"arch_0" ,//48 +"arch_1" ,//49 +"arch_2" ,//50 +"arch_3" ,//51 +"arch_4" ,//52 +"arch_5" ,//53 +"arch_6" ,//54 +"arch_7" ,//55 +"NULL" ,//56 +"NULL" ,//57 +"NULL" ,//58 +"NULL" ,//59 +"NULL" ,//60 +"NULL" ,//61 +"NULL" ,//62 +"NULL" //63 +};int main (int argc,char *argv[]) {
@@ -117,10 +185,17 @@ int main(int argc, char *argv[]) sum += val[j];printf ("T=%10u " , (unsigned int )sum); -if ( full || (pcd[i].nr_vals <=4 ) ) +if ( full || (pcd[i].nr_vals <=4 ) ){ +if (strcmp (pcd[i].name,"hypercalls" ) ==0 ){ +for ( j =0 ; j < pcd[i].nr_vals; j++ ) +printf ("%s\t" , hypercall_name_table[j]); +printf ("\n" ); + }for ( j =0 ; j < pcd[i].nr_vals; j++ )printf (" %10u" , (unsigned int )val[j]); + } +printf ("\n" ); val += pcd[i].nr_vals; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
tools/misc/xenperf.c line 24
Quoted 6 lines · Ken Hironaka
tools/misc/xenperf.c +5
-0+const char * hypercall_name_table[64 ]= +{ +"set_trap_table" ,//0 +"mmu_update" ,//1 +"set_gdt" ,//2
...
Rather than have all those numbers in the comments, it would be better to use the C99 array initialization syntax:
const char* hypercall_name_table[64] = {
[__HYPERVISOR_set_trap_table] = "set_trap_table",
[__HYPERVISOR_mmu_update] = "mmu_update",...
};
Quoted 19 lines
tools/misc/xenperf.c +8
-1@@ -117,10 +185,17 @@ int main(int argc, char *argv[]) sum += val[j];printf ("T=%10u " , (unsigned int )sum); -if ( full || (pcd[i].nr_vals <=4 ) ) +if ( full || (pcd[i].nr_vals <=4 ) ){ +if (strcmp (pcd[i].name,"hypercalls" ) ==0 ){ +for ( j =0 ; j < pcd[i].nr_vals; j++ ) +printf ("%s\t" , hypercall_name_table[j]); +printf ("\n" ); + }for ( j =0 ; j < pcd[i].nr_vals; j++ )printf (" %10u" , (unsigned int )val[j]); + } +printf ("\n" ); val += pcd[i].nr_vals;
Quoted 1 line
}
Looks like the whitespace got out of hand here. Please double-check.
Also, it looks like this file has had some tabs creep into it. You should probably send a tab-removal patch first, then this patch on top of that.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 9 lines · Ken Hironaka
Quoted 5 lines
tools/misc/xenperf.c +5
-0+const char * hypercall_name_table[64 ]= +{ +"set_trap_table" ,//0 +"mmu_update" ,//1 +"set_gdt" ,//2 ...
Quoted 8 lines
Rather than have all those numbers in the comments, it would be better to use the C99 array initialization syntax:
const char* hypercall_name_table[64] = { [__HYPERVISOR_set_trap_table] = "set_trap_table", [__HYPERVISOR_mmu_update] = "mmu_update",...
};
Agreed!
Also, just thought I'd be pedantic and mention we generally seek to avoid C++ style comments. We seem to have standardised on /* */ comments.
Sorry, Ken, I know it's geeky but I saw those slashes and couldn't resist! Maybe it'll be useful for future patches.
Cheers,
Mark
Quoted 26 lines
Quoted 19 lines
tools/misc/xenperf.c +8
-1@@ -117,10 +185,17 @@ int main(int argc, char *argv[]) sum += val[j];printf ("T=%10u " , (unsigned int )sum); -if ( full || (pcd[i].nr_vals <=4 ) ) +if ( full || (pcd[i].nr_vals <=4 ) ){ +if (strcmp (pcd[i].name,"hypercalls" ) ==0 ){ +for ( j =0 ; j < pcd[i].nr_vals; j++ ) +printf ("%s\t" , hypercall_name_table[j]); +printf ("\n" ); + }for ( j =0 ; j < pcd[i].nr_vals; j++ )printf (" %10u" , (unsigned int )val[j]); + } +printf ("\n" ); val += pcd[i].nr_vals;Quoted 1 line
}Looks like the whitespace got out of hand here. Please double-check.
Also, it looks like this file has had some tabs creep into it. You should probably send a tab-removal patch first, then this patch on top of that.
Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel!