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 1/2] cpu steal time accounting

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/2] cpu steal time accounting
From: Rik van Riel <riel@xxxxxxxxxx>
Date: Mon, 20 Feb 2006 19:51:21 -0500 (EST)
Delivery-date: Tue, 21 Feb 2006 01:04:31 +0000
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
Allow guest domains to get information from the hypervisor on how much
cpu time their virtual cpus have used.  This is needed to estimate the
cpu steal time.

Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>

--- xen/include/public/vcpu.h.steal     2006-02-07 18:01:41.000000000 -0500
+++ xen/include/public/vcpu.h   2006-02-17 13:51:45.000000000 -0500
@@ -51,6 +51,14 @@
 /* Returns 1 if the given VCPU is up. */
 #define VCPUOP_is_up                3
 
+/*
+ * Get information on how much CPU time this VCPU has used, etc...
+ *
+ * @extra_arg == pointer to an empty dom0_getvcpuinfo_t, the "OUT" variables
+ *               of which filled in with scheduler info.
+ */
+#define VCPUOP_cpu_info             4
+
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 
 /*
--- xen/common/domain.c.steal   2006-02-07 18:01:40.000000000 -0500
+++ xen/common/domain.c 2006-02-17 13:52:44.000000000 -0500
@@ -451,8 +451,24 @@
     case VCPUOP_is_up:
         rc = !test_bit(_VCPUF_down, &v->vcpu_flags);
         break;
+
+    case VCPUOP_cpu_info:
+       {
+           struct dom0_getvcpuinfo vi = { 0, };
+           vi.online = !test_bit(_VCPUF_down, &v->vcpu_flags);
+           vi.blocked = test_bit(_VCPUF_blocked, &v->vcpu_flags);
+           vi.running  = test_bit(_VCPUF_running, &v->vcpu_flags);
+           vi.cpu_time = v->cpu_time;
+           vi.cpu = v->processor;
+           rc = 0;
+
+           if ( copy_to_user(arg, &vi, sizeof(dom0_getvcpuinfo_t)) )
+               rc = -EFAULT;
+           break;
+       }
     }
 
+
     return rc;
 }
 

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