Re: [PATCH 0/6] Add virNodeGetMemoryStats() API

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

 



On Wed, May 25, 2011 at 05:53:02PM +0900, Minoru Usui wrote:
> Hi, everyone.
> 
> I wrote new API called virNodeGetMemoryStats().
> It returns total/free/buffer/cached memory of the node from /proc/meminfo.
> The user I/F is like virNodeGetCPUStats().
> 
> Previous discussion is here.
> (See about virNodeGetFreeMemory() part.)
> 
>   http://www.mail-archive.com/libvir-list@xxxxxxxxxx/msg32553.html
> 
> This patch series based on latest git tree.
> If my virNodeGetCPUStats() patch series applied, I'll rebase on it.

As with your patches for CPUStats, I think the code in this
series looks good, but have a question about the API design.
I think we should add a parameter to the API to allow a query
of memory data for individual NUMA cells

 int                     virNodeGetMemoryStats(virConnectPtr conn,
                                               int cellNum,
                                               virMemoryStatsPtr params,
                                               int *nparams,
                                               unsigned int flags);

And a constant to use if wanting cummulative data for all cells

   #define  VIR_NODE_MEMORY_STATS_ALL_CELLS -1

So to get memory stats for each NUMA cell

   virNodeGetMemoryStats(conn, 0, params, nparams, flags);
   virNodeGetMemoryStats(conn, 1, params, nparams, flags);
   virNodeGetMemoryStats(conn, 2, params, nparams, flags);
   virNodeGetMemoryStats(conn, 3, params, nparams, flags);

Or to get memory statas for the whole host

   virNodeGetMemoryStats(conn, VIR_NODE_MEMORY_STATS_ALL_CELLS, params, nparams, flags);

You currently use /proc/meminfo to get the host memory
stats. The per-NUMA node data is available in similar
format at the files:

  /sys/devices/system/node/*/meminfo

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]