[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 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);

> > +    }
> > +
> > +    libxl_psr_hw_info_list_free(info, nr);
> > +    return rc;
> > +}
> > +
> >  int main_psr_cat_cbm_set(int argc, char **argv)
> >  {
> >      uint32_t domid;
> > @@ -597,20 +624,24 @@ int main_psr_cat_show(int argc, char **argv)
> >  int main_psr_hwinfo(int argc, char **argv)
> >  {
> >      int opt, ret = 0;
> > -    bool all = true, cmt = false, cat = false;
> > +    bool all = true, cmt = false, cat = false, mba = false;
> >      static struct option opts[] = {
> 
> const?
> 
Ok, thanks!

> 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®.