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

Re: [Xen-devel] [PATCH v2 11/15] tools: implement the new xl get hw info interface



On Thu, Aug 31, 2017 at 01:57:09PM +0800, Yi Sun wrote:
> On 17-08-30 10:23:18, Roger Pau Monn� wrote:
> > On Thu, Aug 24, 2017 at 09:14:45AM +0800, Yi Sun wrote:
> > > +static int psr_mba_hwinfo(void)
> > > +{
> > > +    int rc;
> > > +    unsigned int i, nr;
> > > +    libxl_psr_hw_info *info;
> > > +
> > > +    rc = libxl_psr_get_hw_info(ctx, &info, &nr,
> > > +                               LIBXL_PSR_FEAT_TYPE_MBA, 0);
> > > +    if (rc)
> > > +        return rc;
> > > +
> > > +    printf("Memory Bandwidth Allocation (MBA):\n");
> > > +
> > > +    for (i = 0; i < nr; i++) {
> > > +        printf("%-16s: %u\n", "Socket ID", info[i].id);
> > > +        printf("%-16s: %s\n", "Linear Mode",
> > > +               info[i].u.mba.linear ? "Enabled" : "Disabled");
> > > +        printf("%-16s: %u\n", "Maximum COS", info[i].u.mba.cos_max);
> > > +        printf("%-16s: %u\n", "Maximum Throttling Value",
> > > +               info[i].u.mba.thrtl_max);
> > > +        printf("%-16s: %u\n", "Default Throttling Value", 0);
> > 
> > If you really want to left-justify, shouldn't you choose a value that
> > aligns everything nicely (strlen("Default Throttling Valu") is
> > already greater than 16).
> > 
> Sorry for missing this.
> 
> > In fact you can do the alignment manually in the format string, and
> > avoid passing the name as the first parameter.
> > 
> DYM a sentence like below?
>   printf("%-*s: %u\n", 23, "Default Throttling Value", 0);

I was thinking more like:

printf("             Maximum COS: %u\n", ...
printf("Maximum Throttling Value: %u\n", ...
printf("Default Throttling Value: %u\n", ...

Or however you wish to align them. Although I don't have a strong
opinion, as long as it's easy to read.

Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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