WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch] xenmon.py: fix sleep duration, reporting of time int

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch] xenmon.py: fix sleep duration, reporting of time intervals
From: "Diwaker Gupta" <diwaker.lists@xxxxxxxxx>
Date: Mon, 6 Mar 2006 13:11:23 -0800
Delivery-date: Mon, 06 Mar 2006 21:12:13 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=hAtq8AjrjeexY3qppp90VJRhqOlBWJMgnW3a08hw3pLOiKdTAMEj//C1DdzAvL2YvpOOSS0OtbpGFdRkj/x7rSHIVXL9rrykNlr6d0bN5cNg2MbfZ5TmjKrIo0gZYazKG/qtzgZtYpN4Ev26SByKTL/ZCD2GmTq1vhhkdZ7Toms=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>