From: Mark Williamson Subject: Re: [PATCH][RFC]xenperf hypercall pretty print Date: Fri, 18 Aug 2006 17:32:56 +0100 Message-ID: <200608181732.57461.mark.williamson@cl.cam.ac.uk> References: <1155894487.4637.101.camel@pingi.sky.yk.fujitsu.co.jp> <1155918504.23182.7.camel@basalt.austin.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1155918504.23182.7.camel@basalt.austin.ibm.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Hollis Blanchard , Ken Hironaka List-Id: xen-devel@lists.xenproject.org > On Fri, 2006-08-18 at 18:48 +0900, Ken Hironaka wrote: > > +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", > ... > }; 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 > > @@ -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; > > } > > 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. -- 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!