ia64/xen-unstable

changeset 10654:222b492cc063

[XENMON] This patch removes the magic number "31" for readability.
The number "31" means the idle domain ID.

In detail:
- display the idle domain ID with "Idle" instead of "31"
- write to the file "log-idle.log" instead of "log-dom31.log".

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Wed Jul 05 11:31:33 2006 +0100 (2006-07-05)
parents 5fd332b263d4
children 462d6e4cb29a
files tools/xenmon/xenmon.py
line diff
     1.1 --- a/tools/xenmon/xenmon.py	Wed Jul 05 11:30:12 2006 +0100
     1.2 +++ b/tools/xenmon/xenmon.py	Wed Jul 05 11:31:33 2006 +0100
     1.3 @@ -36,6 +36,7 @@ import sys
     1.4  # constants
     1.5  NSAMPLES = 100
     1.6  NDOMAINS = 32
     1.7 +IDLE_DOMAIN = 31 # idle domain's ID
     1.8  
     1.9  # the struct strings for qos_info
    1.10  ST_DOM_INFO = "6Q4i32s"
    1.11 @@ -253,6 +254,14 @@ def display(scr, row, col, str, attr=0):
    1.12          sys.exit(1)
    1.13  
    1.14  
    1.15 +# diplay domain id
    1.16 +def display_domain_id(scr, row, col, dom):
    1.17 +    if dom == IDLE_DOMAIN:
    1.18 +        display(scr, row, col-1, "Idle")
    1.19 +    else:
    1.20 +        display(scr, row, col, "%d" % dom)
    1.21 +
    1.22 +
    1.23  # the live monitoring code
    1.24  def show_livestats(cpu):
    1.25      ncpu = 1         # number of cpu's on this platform
    1.26 @@ -361,7 +370,7 @@ def show_livestats(cpu):
    1.27                  # display gotten
    1.28                  row += 1 
    1.29                  col = 2
    1.30 -                display(stdscr, row, col, "%d" % dom)
    1.31 +                display_domain_id(stdscr, row, col, dom)
    1.32                  col += 4
    1.33                  display(stdscr, row, col, "%s" % time_scale(h2[dom][0][0]))
    1.34                  col += 12
    1.35 @@ -386,7 +395,7 @@ def show_livestats(cpu):
    1.36                  if options.allocated:
    1.37                      row += 1
    1.38                      col = 2
    1.39 -                    display(stdscr, row, col, "%d" % dom)
    1.40 +                    display_domain_id(stdscr, row, col, dom)
    1.41                      col += 28
    1.42                      display(stdscr, row, col, "%s/ex" % time_scale(h2[dom][1]))
    1.43                      col += 42
    1.44 @@ -398,7 +407,7 @@ def show_livestats(cpu):
    1.45                  if options.blocked:
    1.46                      row += 1
    1.47                      col = 2
    1.48 -                    display(stdscr, row, col, "%d" % dom)
    1.49 +                    display_domain_id(stdscr, row, col, dom)
    1.50                      col += 4
    1.51                      display(stdscr, row, col, "%s" % time_scale(h2[dom][2][0]))
    1.52                      col += 12
    1.53 @@ -418,7 +427,7 @@ def show_livestats(cpu):
    1.54                  if options.waited:
    1.55                      row += 1
    1.56                      col = 2
    1.57 -                    display(stdscr, row, col, "%d" % dom)
    1.58 +                    display_domain_id(stdscr, row, col, dom)
    1.59                      col += 4
    1.60                      display(stdscr, row, col, "%s" % time_scale(h2[dom][3][0]))
    1.61                      col += 12
    1.62 @@ -438,7 +447,7 @@ def show_livestats(cpu):
    1.63                  if options.excount:
    1.64                      row += 1
    1.65                      col = 2
    1.66 -                    display(stdscr, row, col, "%d" % dom)
    1.67 +                    display_domain_id(stdscr, row, col, dom)
    1.68                      
    1.69                      col += 28
    1.70                      display(stdscr, row, col, "%d/s" % h2[dom][4])
    1.71 @@ -451,7 +460,7 @@ def show_livestats(cpu):
    1.72                  if options.iocount:
    1.73                      row += 1
    1.74                      col = 2
    1.75 -                    display(stdscr, row, col, "%d" % dom)
    1.76 +                    display_domain_id(stdscr, row, col, dom)
    1.77                      col += 4
    1.78                      display(stdscr, row, col, "%d/s" % h2[dom][5][0])
    1.79                      col += 24
    1.80 @@ -558,7 +567,10 @@ def writelog():
    1.81      curr = last = time.time()
    1.82      outfiles = {}
    1.83      for dom in range(0, NDOMAINS):
    1.84 -        outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), 'w')
    1.85 +        if dom == IDLE_DOMAIN:
    1.86 +            outfiles[dom] = Delayed("%s-idle.log" % options.prefix, 'w')
    1.87 +        else:
    1.88 +            outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), 'w')
    1.89          outfiles[dom].delayed_write("# passed cpu dom cpu(tot) cpu(%) cpu/ex allocated/ex blocked(tot) blocked(%) blocked/io waited(tot) waited(%) waited/ex ex/s io(tot) io/ex\n")
    1.90  
    1.91      while options.duration == 0 or interval < (options.duration * 1000):