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-changelog

[Xen-changelog] [xen-unstable] xend: Add free memory size of every node

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Add free memory size of every node in physinfo to help user to
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Feb 2008 18:10:11 -0800
Delivery-date: Tue, 26 Feb 2008 18:10:08 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204038008 0
# Node ID 6ef22eefc36056daa4f7e6c6f14873ea72658161
# Parent  c8b58f82d893d821d60cb96225f94170bd7ae595
xend: Add free memory size of every node in physinfo to help user to
get usage of memory of their NUMA machine.

Signed-off-by: Duan Ronghui <ronghui.duan@xxxxxxxxx>
---
 tools/python/xen/lowlevel/xc/xc.c |   13 ++++++++++++-
 tools/python/xen/xend/XendNode.py |   18 +++++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff -r c8b58f82d893 -r 6ef22eefc360 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue Feb 26 14:50:45 2008 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Feb 26 15:00:08 2008 +0000
@@ -764,7 +764,8 @@ static PyObject *pyxc_physinfo(XcObject 
     xc_physinfo_t info;
     char cpu_cap[128], *p=cpu_cap, *q=cpu_cap;
     int i, j, max_cpu_id;
-    PyObject *ret_obj, *node_to_cpu_obj;
+    uint64_t free_heap;
+    PyObject *ret_obj, *node_to_cpu_obj, *node_to_memory_obj;
     xc_cpu_to_node_t map[MAX_CPU_ID + 1];
 
     set_xen_guest_handle(info.cpu_to_node, map);
@@ -812,7 +813,17 @@ static PyObject *pyxc_physinfo(XcObject 
         PyList_Append(node_to_cpu_obj, cpus); 
     }
 
+    node_to_memory_obj = PyList_New(0);
+
+    for ( i = 0; i < info.nr_nodes; i++ )
+    {
+       xc_availheap(self->xc_handle, 0, 0, i, &free_heap);
+       PyList_Append(node_to_memory_obj,
+           PyInt_FromLong(free_heap / 1024));
+    }
+       
     PyDict_SetItemString(ret_obj, "node_to_cpu", node_to_cpu_obj);
+    PyDict_SetItemString(ret_obj, "node_to_memory", node_to_memory_obj);
  
     return ret_obj;
 #undef MAX_CPU_ID
diff -r c8b58f82d893 -r 6ef22eefc360 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Tue Feb 26 14:50:45 2008 +0000
+++ b/tools/python/xen/xend/XendNode.py Tue Feb 26 15:00:08 2008 +0000
@@ -573,6 +573,20 @@ class XendNode:
         except:
             str='none\n'
         return str[:-1];
+    def format_node_to_memory(self, pinfo):
+        str=''
+        whitespace=''
+        try:
+            node_to_memory=pinfo['node_to_memory']
+            for i in range(0, pinfo['nr_nodes']):
+                str+='%snode%d:%d\n' % (whitespace,
+                                        i,
+                                        node_to_memory[i] / 1024)
+                whitespace='%25s' % ''
+        except:
+            str='none\n'
+        return str[:-1];
+
 
     def physinfo(self):
         info = self.xc.physinfo()
@@ -583,6 +597,7 @@ class XendNode:
         info['total_memory'] = info['total_memory'] / 1024
         info['free_memory']  = info['free_memory'] / 1024
         info['node_to_cpu']  = self.format_node_to_cpu(info)
+        info['node_to_memory'] = self.format_node_to_memory(info)
 
         ITEM_ORDER = ['nr_cpus',
                       'nr_nodes',
@@ -592,7 +607,8 @@ class XendNode:
                       'hw_caps',
                       'total_memory',
                       'free_memory',
-                      'node_to_cpu'
+                      'node_to_cpu',
+                      'node_to_memory'
                       ]
 
         return [[k, info[k]] for k in ITEM_ORDER]

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Add free memory size of every node in physinfo to help user to, Xen patchbot-unstable <=