All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] getvcpuinfo additional information
@ 2006-11-07 21:56 Ben Thomas
  2006-11-07 22:19 ` Daniel P. Berrange
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Thomas @ 2006-11-07 21:56 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

On a number of instances, it has proved quite useful to be able to
easily examine more of the VCPU state. Specifically, the information
contained in the runstate structure.  This patch extends the
returned information to contain the entire runstate structure.
A simple usage example is a dom0 user-mode program that can dump all
of the times for each VCPU (eg, running, blocked, runnable).


Signed-off-by: Ben Thomas (ben@virtualiron.com)

-- 
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
bthomas@virtualiron.com                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                    Lowell, MA 01851

[-- Attachment #2: 10021-vcpu_info.patch --]
[-- Type: text/x-patch, Size: 3698 bytes --]

# Return more information about the VCPU in the getvcpuinfo call.  This is
# pretty useful for debug and investigation.
#
# Signed-off-by: Ben Thomas (ben@virtualiron.com)

Index: xen-unstable.hg/tools/libxc/xc_private.c
===================================================================
--- xen-unstable.hg.orig/tools/libxc/xc_private.c	2006-11-06 17:12:03.000000000 -0500
+++ xen-unstable.hg/tools/libxc/xc_private.c	2006-11-06 17:12:08.000000000 -0500
@@ -258,7 +258,7 @@
         PERROR("Could not get info on domain");
         return -1;
     }
-    return domctl.u.getvcpuinfo.cpu_time;
+    return domctl.u.getvcpuinfo.runstate.time[RUNSTATE_running];
 }
 
 
Index: xen-unstable.hg/tools/python/xen/lowlevel/xc/xc.c
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/lowlevel/xc/xc.c	2006-11-06 17:12:03.000000000 -0500
+++ xen-unstable.hg/tools/python/xen/lowlevel/xc/xc.c	2006-11-06 17:12:08.000000000 -0500
@@ -312,7 +312,7 @@
                               "online",   info.online,
                               "blocked",  info.blocked,
                               "running",  info.running,
-                              "cpu_time", info.cpu_time,
+                              "cpu_time", info.runstate.time[RUNSTATE_running],
                               "cpu",      info.cpu);
 
     cpulist = PyList_New(0);
Index: xen-unstable.hg/tools/xenstat/libxenstat/src/xenstat.c
===================================================================
--- xen-unstable.hg.orig/tools/xenstat/libxenstat/src/xenstat.c	2006-11-06 17:12:03.000000000 -0500
+++ xen-unstable.hg/tools/xenstat/libxenstat/src/xenstat.c	2006-11-06 17:12:08.000000000 -0500
@@ -550,7 +550,7 @@
 			}
 			else {
 				node->domains[i].vcpus[vcpu].online = info.online;
-				node->domains[i].vcpus[vcpu].ns = info.cpu_time;
+				node->domains[i].vcpus[vcpu].ns = info.runstate.time[RUNSTATE_running];
 			}
 		}
 	}
Index: xen-unstable.hg/xen/common/domctl.c
===================================================================
--- xen-unstable.hg.orig/xen/common/domctl.c	2006-11-06 17:12:03.000000000 -0500
+++ xen-unstable.hg/xen/common/domctl.c	2006-11-06 17:12:08.000000000 -0500
@@ -515,7 +515,7 @@
         op->u.getvcpuinfo.online   = !test_bit(_VCPUF_down, &v->vcpu_flags);
         op->u.getvcpuinfo.blocked  = test_bit(_VCPUF_blocked, &v->vcpu_flags);
         op->u.getvcpuinfo.running  = test_bit(_VCPUF_running, &v->vcpu_flags);
-        op->u.getvcpuinfo.cpu_time = runstate.time[RUNSTATE_running];
+        memcpy(&op->u.getvcpuinfo.runstate, &runstate, sizeof(runstate));
         op->u.getvcpuinfo.cpu      = v->processor;
         ret = 0;
 
Index: xen-unstable.hg/xen/include/public/domctl.h
===================================================================
--- xen-unstable.hg.orig/xen/include/public/domctl.h	2006-11-06 17:12:03.000000000 -0500
+++ xen-unstable.hg/xen/include/public/domctl.h	2006-11-06 17:12:08.000000000 -0500
@@ -15,6 +15,7 @@
 #endif
 
 #include "xen.h"
+#include "vcpu.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
 
@@ -239,8 +240,8 @@
     uint8_t  online;                  /* currently online (not hotplugged)? */
     uint8_t  blocked;                 /* blocked waiting for an event? */
     uint8_t  running;                 /* currently scheduled on its CPU? */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
     uint32_t cpu;                     /* current mapping   */
+    vcpu_runstate_info_t runstate;    /* VCPU runstate info (see vcpu.h) */
 };
 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);

[-- 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] 4+ messages in thread

end of thread, other threads:[~2006-11-08  0:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-07 21:56 [PATCH] getvcpuinfo additional information Ben Thomas
2006-11-07 22:19 ` Daniel P. Berrange
2006-11-07 22:33   ` Ben Thomas
2006-11-08  0:08     ` Daniel P. Berrange

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.