[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] cpu steal time accounting


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • 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
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.