[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC] virtio: Report new guest memory statistics pertin
From: |
Jamie Lokier |
Subject: |
Re: [Qemu-devel] [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning (V2) |
Date: |
Mon, 9 Nov 2009 19:01:44 +0000 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Adam Litke wrote:
> +static inline void print_stat(Monitor *mon, uint32_t val, const char *label)
> +{
> + if (val != -1) {
> + monitor_printf(mon, ",%s=%u", label, val);
> + }
> +}
> +
> static void do_info_balloon(Monitor *mon)
> {
> - ram_addr_t actual;
> + QEMUBalloonState s;
> + int ret;
>
> - actual = qemu_balloon_status();
> - if (kvm_enabled() && !kvm_has_sync_mmu())
> + ret = qemu_balloon_status(&s);
> + if (kvm_enabled() && !kvm_has_sync_mmu()) {
> monitor_printf(mon, "Using KVM without synchronous MMU, "
> "ballooning disabled\n");
> - else if (actual == 0)
> + } else if (ret < 0) {
> monitor_printf(mon, "Ballooning not activated in VM\n");
> - else
> - monitor_printf(mon, "balloon: actual=%d\n", (int)(actual >> 20));
> + } else {
> + monitor_printf(mon, "balloon: actual=%d", (int)(s.actual >> 20));
> + print_stat(mon, s.stats.pswapin, "pages_swapped_in");
> + print_stat(mon, s.stats.pswapout, "pages_swapped_out");
> + print_stat(mon, s.stats.panon, "anon_pages");
> + print_stat(mon, s.stats.pgmajfault, "major_page_faults");
> + print_stat(mon, s.stats.pgminfault, "minor_page_faults");
> + print_stat(mon, s.stats.memfree, "free_memory");
> + print_stat(mon, s.stats.memtot, "total_memory");
> + monitor_printf(mon, "\n");
> + }
> +
> }
These days, would it make more sense to emit a QJSON object?
In this case the JSON object is quite human readable too.
-- Jamie
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, (continued)
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, Anthony Liguori, 2009/11/10
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, Rusty Russell, 2009/11/10
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, Anthony Liguori, 2009/11/10
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, Rusty Russell, 2009/11/10
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, Adam Litke, 2009/11/11
- [Qemu-devel] Re: virtio: Add memory statistics reporting to the balloon driver, Rusty Russell, 2009/11/11
Re: [Qemu-devel] [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning (V2), Jamie Lokier, 2009/11/09
Re: [Qemu-devel] [RFC] virtio: Report new guest memory statistics pertinent to memory ballooning (V2),
Jamie Lokier <=