qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, armbru@redhat.com, qemu-block@nongnu.org,
	quintela@redhat.com
Subject: [Qemu-devel] [RFC v2 3/4] hmp: Add a helper function for printing out a Rolling Statistics set
Date: Wed,  4 Mar 2015 10:29:38 +0000	[thread overview]
Message-ID: <1425464979-20578-4-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1425464979-20578-1-git-send-email-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hmp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/hmp.c b/hmp.c
index 735097c..20241d8 100644
--- a/hmp.c
+++ b/hmp.c
@@ -138,6 +138,27 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
     qapi_free_MouseInfoList(mice_list);
 }
 
+__attribute__ (( unused )) /* Until later in patch series */
+static void monitor_printf_RollingStats(Monitor *mon, const char *title,
+                                        RollingStats *r)
+{
+    RollingStatsValueList *list_entry = r->values;
+
+    monitor_printf(mon, "%s: Min/Max: %.8g, %.8g Mean: %.8g "
+                        "(Weighted: %.8g) Count: %" PRIu64
+                        " Values: ",
+                   title, r->min, r->max, r->mean, r->weighted_mean, r->count);
+
+    while (list_entry) {
+        monitor_printf(mon, "%.8g@%" PRIu64 "%s",
+                       list_entry->value->value,
+                       list_entry->value->tag,
+                       list_entry->next ? ", " : "");
+        list_entry = list_entry->next;
+    }
+    monitor_printf(mon, "\n");
+}
+
 void hmp_info_migrate(Monitor *mon, const QDict *qdict)
 {
     MigrationInfo *info;
-- 
2.1.0

  parent reply	other threads:[~2015-03-04 10:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 10:29 [Qemu-devel] [RFC v2 0/4] Rolling statistics utilities Dr. David Alan Gilbert (git)
2015-03-04 10:29 ` [Qemu-devel] [RFC v2 1/4] RollingStats qapi type Dr. David Alan Gilbert (git)
2015-03-04 10:29 ` [Qemu-devel] [RFC v2 2/4] Rolling statistics utilities Dr. David Alan Gilbert (git)
2015-03-04 10:29 ` Dr. David Alan Gilbert (git) [this message]
2015-03-04 10:29 ` [Qemu-devel] [RFC v2 4/4] Example use of rolling statistics in migration Dr. David Alan Gilbert (git)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425464979-20578-4-git-send-email-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).