* [PATCH] xenmon: remove magic number "31" (the idle domain)
@ 2006-07-04 5:37 KUWAMURA Shin'ya
2006-07-04 7:06 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: KUWAMURA Shin'ya @ 2006-07-04 5:37 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: Text/Plain, Size: 325 bytes --]
Hi,
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>
Thanks,
--
KUWAMURA Shin'ya
[-- Attachment #2: xenmon-idle.patch --]
[-- Type: Text/Plain, Size: 3753 bytes --]
diff -r fd6d12935b56 tools/xenmon/xenmon.py
--- a/tools/xenmon/xenmon.py Mon Jul 3 16:07:20 2006 +0100
+++ b/tools/xenmon/xenmon.py Tue Jul 4 13:05:21 2006 +0900
@@ -36,6 +36,7 @@ import sys
# constants
NSAMPLES = 100
NDOMAINS = 32
+IDLE_DOMAIN = 31 # idle domain's ID
# the struct strings for qos_info
ST_DOM_INFO = "6Q4i32s"
@@ -253,6 +254,14 @@ def display(scr, row, col, str, attr=0):
sys.exit(1)
+# diplay domain id
+def display_domain_id(scr, row, col, dom):
+ if dom == IDLE_DOMAIN:
+ display(scr, row, col-1, "Idle")
+ else:
+ display(scr, row, col, "%d" % dom)
+
+
# the live monitoring code
def show_livestats(cpu):
ncpu = 1 # number of cpu's on this platform
@@ -361,7 +370,7 @@ def show_livestats(cpu):
# display gotten
row += 1
col = 2
- display(stdscr, row, col, "%d" % dom)
+ display_domain_id(stdscr, row, col, dom)
col += 4
display(stdscr, row, col, "%s" % time_scale(h2[dom][0][0]))
col += 12
@@ -386,7 +395,7 @@ def show_livestats(cpu):
if options.allocated:
row += 1
col = 2
- display(stdscr, row, col, "%d" % dom)
+ display_domain_id(stdscr, row, col, dom)
col += 28
display(stdscr, row, col, "%s/ex" % time_scale(h2[dom][1]))
col += 42
@@ -398,7 +407,7 @@ def show_livestats(cpu):
if options.blocked:
row += 1
col = 2
- display(stdscr, row, col, "%d" % dom)
+ display_domain_id(stdscr, row, col, dom)
col += 4
display(stdscr, row, col, "%s" % time_scale(h2[dom][2][0]))
col += 12
@@ -418,7 +427,7 @@ def show_livestats(cpu):
if options.waited:
row += 1
col = 2
- display(stdscr, row, col, "%d" % dom)
+ display_domain_id(stdscr, row, col, dom)
col += 4
display(stdscr, row, col, "%s" % time_scale(h2[dom][3][0]))
col += 12
@@ -438,7 +447,7 @@ def show_livestats(cpu):
if options.excount:
row += 1
col = 2
- display(stdscr, row, col, "%d" % dom)
+ display_domain_id(stdscr, row, col, dom)
col += 28
display(stdscr, row, col, "%d/s" % h2[dom][4])
@@ -451,7 +460,7 @@ def show_livestats(cpu):
if options.iocount:
row += 1
col = 2
- display(stdscr, row, col, "%d" % dom)
+ display_domain_id(stdscr, row, col, dom)
col += 4
display(stdscr, row, col, "%d/s" % h2[dom][5][0])
col += 24
@@ -558,7 +567,10 @@ def writelog():
curr = last = time.time()
outfiles = {}
for dom in range(0, NDOMAINS):
- outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), 'w')
+ if dom == IDLE_DOMAIN:
+ outfiles[dom] = Delayed("%s-idle.log" % options.prefix, 'w')
+ else:
+ outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), 'w')
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")
while options.duration == 0 or interval < (options.duration * 1000):
[-- 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] 5+ messages in thread
* Re: [PATCH] xenmon: remove magic number "31" (the idle domain)
2006-07-04 5:37 [PATCH] xenmon: remove magic number "31" (the idle domain) KUWAMURA Shin'ya
@ 2006-07-04 7:06 ` Keir Fraser
2006-07-04 7:48 ` KUWAMURA Shin'ya
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2006-07-04 7:06 UTC (permalink / raw)
To: KUWAMURA Shin'ya; +Cc: xen-devel
On 4 Jul 2006, at 06:37, KUWAMURA Shin'ya wrote:
> 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>
Where does the magic number '31' come from in the first place? That's
not the number Xen uses. It could conflict with the domain id of a
non-idle domain.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xenmon: remove magic number "31" (the idle domain)
2006-07-04 7:06 ` Keir Fraser
@ 2006-07-04 7:48 ` KUWAMURA Shin'ya
2006-07-04 7:57 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: KUWAMURA Shin'ya @ 2006-07-04 7:48 UTC (permalink / raw)
To: Keir.Fraser; +Cc: xen-devel
Hi Keir,
>>>>> On Tue, 4 Jul 2006 08:06:57 +0100
>>>>> Keir.Fraser@cl.cam.ac.uk(Keir Fraser) said:
>
>
> On 4 Jul 2006, at 06:37, KUWAMURA Shin'ya wrote:
>
> > This patch removes the magic number "31" for readability. The number
> > "31" means the idle domain ID.
>
> Where does the magic number '31' come from in the first place? That's
> not the number Xen uses. It could conflict with the domain id of a
> non-idle domain.
"31" comes from xenmon.py and xenbaked.h.
xenmon.py:38:
NDOMAINS = 32
xenbaked.h:42
#define NDOMAINS 32
Notice that 31 is NDOMAINS-1.
Therefore, xenmon supports only up to 32 domains.
Thanks,
--
KUWAMURA Shin'ya
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xenmon: remove magic number "31" (the idle domain)
2006-07-04 7:48 ` KUWAMURA Shin'ya
@ 2006-07-04 7:57 ` Keir Fraser
2006-07-05 16:22 ` Rob Gardner
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2006-07-04 7:57 UTC (permalink / raw)
To: KUWAMURA Shin'ya; +Cc: xen-devel
On 4 Jul 2006, at 08:48, KUWAMURA Shin'ya wrote:
>> Where does the magic number '31' come from in the first place? That's
>> not the number Xen uses. It could conflict with the domain id of a
>> non-idle domain.
>
> "31" comes from xenmon.py and xenbaked.h.
> xenmon.py:38:
> NDOMAINS = 32
>
> xenbaked.h:42
> #define NDOMAINS 32
>
> Notice that 31 is NDOMAINS-1.
>
> Therefore, xenmon supports only up to 32 domains.
That's poor, since it in fact only really supports the first 31 domains
created on a system (domain ids don't necessarily quickly get reused;
and 32nd domid is used as sentinel to indicate idle). It shouldn't be
hard to use a data structure more complicated than (presumably) a small
array indexed by domid.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xenmon: remove magic number "31" (the idle domain)
2006-07-04 7:57 ` Keir Fraser
@ 2006-07-05 16:22 ` Rob Gardner
0 siblings, 0 replies; 5+ messages in thread
From: Rob Gardner @ 2006-07-05 16:22 UTC (permalink / raw)
To: Keir Fraser; +Cc: KUWAMURA Shin'ya, xen-devel
Keir Fraser wrote:
>> Therefore, xenmon supports only up to 32 domains.
>
> That's poor, since it in fact only really supports the first 31
> domains created on a system (domain ids don't necessarily quickly get
> reused; and 32nd domid is used as sentinel to indicate idle). It
> shouldn't be hard to use a data structure more complicated than
> (presumably) a small array indexed by domid.
I know about this problem. I've got a fix for it I prepared some time
ago but never got around to submitting. I'll integrate it with the
latest source and get it sent out this week.
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-07-05 16:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-04 5:37 [PATCH] xenmon: remove magic number "31" (the idle domain) KUWAMURA Shin'ya
2006-07-04 7:06 ` Keir Fraser
2006-07-04 7:48 ` KUWAMURA Shin'ya
2006-07-04 7:57 ` Keir Fraser
2006-07-05 16:22 ` Rob Gardner
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.