All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][XM] Extend width of ID to 5.
@ 2007-04-20 11:40 Petersson, Mats
  2007-04-20 12:22 ` Otavio Salvador
  0 siblings, 1 reply; 4+ messages in thread
From: Petersson, Mats @ 2007-04-20 11:40 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

The Domain ID is currently expected to fit in 3 digits. 

When doing extensive testing on SAVE/RESTORE I can easily get ID's into
the 4-digit range, which makes some of the formatting to get out of
sync. 

Attached (trivial) patch extends the width to 5 digits (and changes some
%-ns to %ns, as the ID for example is right justified, %-ns is
left-justified, which didn't look too good). 

I'm fine with this going into Xen-unstable only, as it's not really of
any functional importance - it just makes things look a bit tidier with
large DOMID numbers. 

Signed off by: Mats Petersson <mats.petersson@amd.com>. 

--
Mats

[-- Attachment #2: patch.extend_domid_width --]
[-- Type: application/octet-stream, Size: 3946 bytes --]

diff -r c7c67a1a7077 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py	Thu Apr 19 21:06:29 2007 +0100
+++ b/tools/python/xen/xm/main.py	Sat May 19 10:52:33 2007 +0100
@@ -910,10 +910,10 @@ def domid_match(domid, info):
            domid == str(info['domid'])
 
 def xm_brief_list(doms):
-    print '%-40s %3s %5s %5s %10s %9s' % \
+    print '%-40s %5s %5s %5s %10s %9s' % \
           ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)')
     
-    format = "%(name)-40s %(domid)3s %(mem)5d %(vcpus)5d %(state)10s " \
+    format = "%(name)-40s %(domid)5s %(mem)5d %(vcpus)5d %(state)10s " \
              "%(cpu_time)8.1f"
     
     for dom in doms:
@@ -921,11 +921,11 @@ def xm_brief_list(doms):
         print format % d
 
 def xm_label_list(doms):
-    print '%-32s %3s %5s %5s %5s %9s %-8s' % \
+    print '%-32s %5s %5s %5s %5s %9s %-8s' % \
           ('Name', 'ID', 'Mem', 'VCPUs', 'State', 'Time(s)', 'Label')
     
     output = []
-    format = '%(name)-32s %(domid)3s %(mem)5d %(vcpus)5d %(state)10s ' \
+    format = '%(name)-32s %(domid)5s %(mem)5d %(vcpus)5d %(state)10s ' \
              '%(cpu_time)8.1f %(seclabel)9s'
 
     if serverType != SERVER_XEN_API:
@@ -1015,10 +1015,10 @@ def xm_vcpu_list(args):
             doms = server.xend.domains(False)
             dominfo = map(server.xend.domain.getVCPUInfo, doms)
 
-    print '%-32s %3s %5s %5s %5s %9s %s' % \
+    print '%-32s %5s %5s %5s %5s %9s %s' % \
           ('Name', 'ID', 'VCPU', 'CPU', 'State', 'Time(s)', 'CPU Affinity')
 
-    format = '%(name)-32s %(domid)3d %(number)5d %(c)5s %(s)5s ' \
+    format = '%(name)-32s %(domid)5d %(number)5d %(c)5s %(s)5s ' \
              ' %(cpu_time)8.1f %(cpumap)s'
 
     for dom in dominfo:
@@ -1378,7 +1378,7 @@ def xm_sched_sedf(args):
         info['period']  = ns_to_ms(info['period'])
         info['slice']   = ns_to_ms(info['slice'])
         info['latency'] = ns_to_ms(info['latency'])
-        print( ("%(name)-32s %(domid)3d %(period)9.1f %(slice)9.1f" +
+        print( ("%(name)-32s %(domid)5d %(period)9.1f %(slice)9.1f" +
                 " %(latency)7.1f %(extratime)6d %(weight)6d") % info)
 
     check_sched_type('sedf')
@@ -1424,7 +1424,7 @@ def xm_sched_sedf(args):
 
     # print header if we aren't setting any parameters
     if len(opts.keys()) == 0:
-        print '%-33s %-2s %-4s %-4s %-7s %-5s %-6s' % \
+        print '%-33s %4s %-4s %-4s %-7s %-5s %-6s' % \
               ('Name','ID','Period(ms)', 'Slice(ms)', 'Lat(ms)',
                'Extra','Weight')
     
@@ -1488,7 +1488,7 @@ def xm_sched_credit(args):
             err("Domain '%s' does not exist." % domid)
             usage('sched-credit')
         # print header if we aren't setting any parameters
-        print '%-33s %-2s %-6s %-4s' % ('Name','ID','Weight','Cap')
+        print '%-33s %4s %6s %4s' % ('Name','ID','Weight','Cap')
         
         for d in doms:
             try:
@@ -1510,7 +1510,7 @@ def xm_sched_credit(args):
             
             info['name']  = d['name']
             info['domid'] = int(d['domid'])
-            print( ("%(name)-32s %(domid)3d %(weight)6d %(cap)4d") % info)
+            print( ("%(name)-32s %(domid)5d %(weight)6d %(cap)4d") % info)
     else:
         if domid is None:
             # place holder for system-wide scheduler parameters
@@ -1673,7 +1673,7 @@ def xm_uptime(args):
     doms = getDomains(params, 'running')
 
     if short_mode == 0:
-        print 'Name                              ID Uptime'
+        print '%-33s %4s %s ' % ('Name','ID','Uptime')
 
     for dom in doms:
         d = parse_doms_info(dom)
@@ -1707,7 +1707,7 @@ def xm_uptime(args):
             upstring += ", " + d['name'] + " (" + d['domid'] + ")"
         else:
             upstring += ':%(seconds)02d' % vars()
-            upstring = ("%(name)-32s %(domid)3s " % d) + upstring
+            upstring = ("%(name)-32s %(domid)5s " % d) + upstring
 
         print upstring
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][XM] Extend width of ID to 5.
  2007-04-20 11:40 [PATCH][XM] Extend width of ID to 5 Petersson, Mats
@ 2007-04-20 12:22 ` Otavio Salvador
  2007-04-20 13:13   ` Petersson, Mats
  0 siblings, 1 reply; 4+ messages in thread
From: Otavio Salvador @ 2007-04-20 12:22 UTC (permalink / raw)
  To: Petersson, Mats; +Cc: xen-devel

"Petersson, Mats" <Mats.Petersson@amd.com> writes:

> Attached (trivial) patch extends the width to 5 digits (and changes some
> %-ns to %ns, as the ID for example is right justified, %-ns is
> left-justified, which didn't look too good). 

The only thing it can mess is automated tests and routines that uses
the fixed width and will need a fix after this patch gets in.

-- 
Otavio Salvador                  O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH][XM] Extend width of ID to 5.
  2007-04-20 12:22 ` Otavio Salvador
@ 2007-04-20 13:13   ` Petersson, Mats
  2007-04-20 13:17     ` Otavio Salvador
  0 siblings, 1 reply; 4+ messages in thread
From: Petersson, Mats @ 2007-04-20 13:13 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: xen-devel

 

> -----Original Message-----
> From: Otavio Salvador [mailto:otavio@ossystems.com.br] 
> Sent: 20 April 2007 13:22
> To: Petersson, Mats
> Cc: xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] [PATCH][XM] Extend width of ID to 5.
> 
> "Petersson, Mats" <Mats.Petersson@amd.com> writes:
> 
> > Attached (trivial) patch extends the width to 5 digits (and 
> changes some
> > %-ns to %ns, as the ID for example is right justified, %-ns is
> > left-justified, which didn't look too good). 
> 
> The only thing it can mess is automated tests and routines that uses
> the fixed width and will need a fix after this patch gets in.

Yes, of course, but such scrips would also be broken when the numbers
get too big to fit in the fields, so those scripts are already possibly
broken. Any script that parses the output of a program (and wishes to
remain functional after revisions of the software) should use flexible
field parsing rather than column-grabbing, in my opinion. 

But it's also why I suggested that it may go into unstable only, rather
than into the near-release 3.0.5 tree. 

--
Mats
> 
> -- 
> Otavio Salvador                  O.S. Systems
> E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
> Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][XM] Extend width of ID to 5.
  2007-04-20 13:13   ` Petersson, Mats
@ 2007-04-20 13:17     ` Otavio Salvador
  0 siblings, 0 replies; 4+ messages in thread
From: Otavio Salvador @ 2007-04-20 13:17 UTC (permalink / raw)
  To: Petersson, Mats; +Cc: xen-devel

"Petersson, Mats" <Mats.Petersson@amd.com> writes:

>> The only thing it can mess is automated tests and routines that uses
>> the fixed width and will need a fix after this patch gets in.
>
> Yes, of course, but such scrips would also be broken when the numbers
> get too big to fit in the fields, so those scripts are already possibly
> broken. Any script that parses the output of a program (and wishes to
> remain functional after revisions of the software) should use flexible
> field parsing rather than column-grabbing, in my opinion. 

Sure, I agree completely with you while I also know that this kind of
"not-so-well-written-script" exist ;-)

> But it's also why I suggested that it may go into unstable only, rather
> than into the near-release 3.0.5 tree. 

Well, I just think that a note on release notes would solve that.

-- 
Otavio Salvador                  O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-20 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-20 11:40 [PATCH][XM] Extend width of ID to 5 Petersson, Mats
2007-04-20 12:22 ` Otavio Salvador
2007-04-20 13:13   ` Petersson, Mats
2007-04-20 13:17     ` Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.