qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit@irqsave.net>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com,
	"Benoît Canet" <benoit@irqsave.net>,
	stefanha@redhat.com
Subject: [Qemu-devel] [RFC V1 14/14] qapi: Return virtual block device deduplication metrics in QMP
Date: Wed, 16 Jan 2013 17:25:08 +0100	[thread overview]
Message-ID: <1358353508-5369-15-git-send-email-benoit@irqsave.net> (raw)
In-Reply-To: <1358353508-5369-1-git-send-email-benoit@irqsave.net>

---
 block.c |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/block.c b/block.c
index 4e28c55..a245653 100644
--- a/block.c
+++ b/block.c
@@ -2921,6 +2921,40 @@ BlockInfoList *qmp_query_block(Error **errp)
     return head;
 }
 
+static void bdrv_get_dedup_metrics(const BlockDriverState *bs,
+                                   BlockDeviceStats *stats)
+{
+    BlockDriverInfo bdi;
+
+    if (bdrv_get_info((BlockDriverState *) bs, &bdi) < 0) {
+        return;
+    }
+
+    if (!bdi.has_dedup) {
+        return;
+    }
+
+    stats->has_deduplication = true;
+    stats->deduplication = g_malloc0(sizeof(*stats->deduplication));
+    stats->deduplication->deduplicated_clusters =
+        bdi.dedup_metrics.deduplicated_clusters;
+    stats->deduplication->non_deduplicated_clusters =
+        bdi.dedup_metrics.non_deduplicated_clusters;
+    stats->deduplication->missing_data_reads =
+        bdi.dedup_metrics.missing_data_reads;
+    stats->deduplication->ram_hash_creations =
+        bdi.dedup_metrics.ram_hash_creations;
+    stats->deduplication->ram_hash_deletions =
+        bdi.dedup_metrics.ram_hash_deletions;
+    stats->deduplication->ram_usage =
+        bdi.dedup_metrics.ram_usage;
+    stats->deduplication->deleted_clusters =
+        bdi.dedup_metrics.deleted_clusters;
+    stats->deduplication->refcount_overflows =
+        bdi.dedup_metrics.refcount_overflows;
+    stats->deduplication->running = bdi.dedup_running;
+}
+
 BlockStats *bdrv_query_stats(const BlockDriverState *bs)
 {
     BlockStats *s;
@@ -2943,6 +2977,8 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs)
     s->stats->rd_total_time_ns = bs->total_time_ns[BDRV_ACCT_READ];
     s->stats->flush_total_time_ns = bs->total_time_ns[BDRV_ACCT_FLUSH];
 
+    bdrv_get_dedup_metrics(bs, s->stats);
+
     if (bs->file) {
         s->has_parent = true;
         s->parent = bdrv_query_stats(bs->file);
-- 
1.7.10.4

      parent reply	other threads:[~2013-01-16 16:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 16:24 [Qemu-devel] [RFC V1 00/14] QCOW2 deduplication metrics Benoît Canet
2013-01-16 16:24 ` [Qemu-devel] [RFC V1 01/14] qcow2: Add deduplication metrics structures Benoît Canet
2013-01-16 16:24 ` [Qemu-devel] [RFC V1 02/14] qcow2: Initialize deduplication metrics Benoît Canet
2013-01-16 16:24 ` [Qemu-devel] [RFC V1 03/14] qcow2: Collect unaligned writes missing data reads metric Benoît Canet
2013-01-16 16:24 ` [Qemu-devel] [RFC V1 04/14] qcow2: Collect deduplicated cluster metric Benoît Canet
2013-01-16 16:24 ` [Qemu-devel] [RFC V1 05/14] qcow2: Collect undeduplicated " Benoît Canet
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 06/14] qcow2: Count QCowHashNode creation metrics Benoît Canet
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 07/14] qcow2: Count QCowHashNode removal from tree for metrics Benoît Canet
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 08/14] qcow2: Count cluster deleted metric Benoît Canet
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 09/14] qcow2: Count deduplication refcount overflow metric Benoît Canet
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 10/14] qapi: Add support for deduplication infos in qapi-schema.json Benoît Canet
2013-01-16 19:35   ` Eric Blake
2013-01-17 12:15   ` Benoît Canet
2013-01-17 15:38     ` Eric Blake
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 11/14] block: Add deduplication metrics to BlockDriverInfo Benoît Canet
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 12/14] qcow2: Add qcow2_dedup_update_metrics to compute dedup RAM usage Benoît Canet
2013-01-16 20:10   ` Eric Blake
2013-01-17 11:11     ` Benoît Canet
2013-01-17 15:40       ` Eric Blake
2013-01-16 16:25 ` [Qemu-devel] [RFC V1 13/14] qcow2: returns deduplication metrics and status via bdrv_get_info() Benoît Canet
2013-01-16 16:25 ` Benoît Canet [this message]

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=1358353508-5369-15-git-send-email-benoit@irqsave.net \
    --to=benoit@irqsave.net \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).