Diwaker Gupta
2006-Mar-06 21:11 UTC
[Xen-devel] [patch] xenmon.py: fix sleep duration, reporting of time intervals
In log mode (-n option), the timestamp that Xenmon outputs is in increments of the specifid interval (default 1s), not the actual time passed. This patch fixes this. # HG changeset patch # Node ID 7dd31dbf16e75f0f70e0f9c44b2bb2b5fc6eecf1 # Parent 90c71ea18b50f4a7ee1c9fe03f9563a05befb8a6 Fix reporting of time intervals in the log mode of XenMon. Fix duration to sleep between iterations (earlier hardcoded to 1sec) Signed-off-by: Diwaker Gupta <dgupta@cs.ucsd.edu> diff -r 90c71ea18b50 -r 7dd31dbf16e7 tools/xenmon/xenmon.py --- a/tools/xenmon/xenmon.py Mon Mar 6 19:26:30 2006 +0100 +++ b/tools/xenmon/xenmon.py Mon Mar 6 13:02:50 2006 -0800 @@ -502,6 +502,7 @@ def writelog(): shm = mmap.mmap(shmf.fileno(), QOS_DATA_SIZE) interval = 0 + curr = last = time.time() outfiles = {} for dom in range(0, NDOMAINS): outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), ''w'') @@ -561,9 +562,10 @@ def writelog(): h1[dom][4], h1[dom][5][0], h1[dom][5][1])) outfiles[dom].flush() - - interval += options.interval - time.sleep(1) + curr = time.time() + interval += (curr - last) * 1000 + last = curr + time.sleep(options.interval / 1000.0) for dom in range(0, NDOMAINS): outfiles[dom].close() -- Web/Blog/Gallery: http://floatingsun.net/blog _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Freeman
2006-Mar-06 21:25 UTC
Re: [Xen-devel] [patch] xenmon.py: fix sleep duration, reporting of time intervals
Thankyou this patch is useful (also, I''m finding XenMon itself is highly useful). Tim On Mon, 6 Mar 2006 13:11:23 -0800 "Diwaker Gupta" <diwaker.lists@gmail.com> wrote:> In log mode (-n option), the timestamp that Xenmon outputs is in > increments of the specifid interval (default 1s), not the actual time > passed. This patch fixes this. > > # HG changeset patch > # Node ID 7dd31dbf16e75f0f70e0f9c44b2bb2b5fc6eecf1 > # Parent 90c71ea18b50f4a7ee1c9fe03f9563a05befb8a6 > Fix reporting of time intervals in the log mode of XenMon. > Fix duration to sleep between iterations (earlier hardcoded to 1sec) > Signed-off-by: Diwaker Gupta <dgupta@cs.ucsd.edu> > > diff -r 90c71ea18b50 -r 7dd31dbf16e7 tools/xenmon/xenmon.py > --- a/tools/xenmon/xenmon.py Mon Mar 6 19:26:30 2006 +0100 > +++ b/tools/xenmon/xenmon.py Mon Mar 6 13:02:50 2006 -0800 > @@ -502,6 +502,7 @@ def writelog(): > shm = mmap.mmap(shmf.fileno(), QOS_DATA_SIZE) > > interval = 0 > + curr = last = time.time() > outfiles = {} > for dom in range(0, NDOMAINS): > outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), ''w'') > @@ -561,9 +562,10 @@ def writelog(): > h1[dom][4], > h1[dom][5][0], h1[dom][5][1])) > outfiles[dom].flush() > - > - interval += options.interval > - time.sleep(1) > + curr = time.time() > + interval += (curr - last) * 1000 > + last = curr > + time.sleep(options.interval / 1000.0) > > for dom in range(0, NDOMAINS): > outfiles[dom].close() > > -- > Web/Blog/Gallery: http://floatingsun.net/blog > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel