Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40353/?format=api
{ "id": 40353, "url": "http://patchwork.ozlabs.org/api/patches/40353/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1259946695-15784-15-git-send-email-lcapitulino@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1259946695-15784-15-git-send-email-lcapitulino@redhat.com>", "list_archive_url": null, "date": "2009-12-04T17:11:32", "name": "[14/17] block: Convert bdrv_info_stats() to QObject", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a9d7028cba02b019c4a2625758ce23e212d4decd", "submitter": { "id": 2649, "url": "http://patchwork.ozlabs.org/api/people/2649/?format=api", "name": "Luiz Capitulino", "email": "lcapitulino@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1259946695-15784-15-git-send-email-lcapitulino@redhat.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/40353/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/40353/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Received": [ "from lists.gnu.org (lists.gnu.org [199.232.76.165])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client did not present a certificate)\n\tby ozlabs.org (Postfix) with ESMTPS id 7937FB7BA5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 5 Dec 2009 04:42:25 +1100 (EST)", "from localhost ([127.0.0.1]:52671 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.43) id 1NGcAg-0002M7-LW\n\tfor incoming@patchwork.ozlabs.org; Fri, 04 Dec 2009 12:42:22 -0500", "from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)\n\tid 1NGbhZ-0001Jy-Go\n\tfor qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:17 -0500", "from exim by lists.gnu.org with spam-scanned (Exim 4.43)\n\tid 1NGbhX-0001Gl-2p\n\tfor qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:16 -0500", "from [199.232.76.173] (port=44840 helo=monty-python.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.43) id 1NGbhW-0001GT-Oj\n\tfor qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:14 -0500", "from mx1.redhat.com ([209.132.183.28]:52909)\n\tby monty-python.gnu.org with esmtp (Exim 4.60)\n\t(envelope-from <lcapitulino@redhat.com>) id 1NGbhW-0008PV-KT\n\tfor qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:14 -0500", "from int-mx01.intmail.prod.int.phx2.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\tby mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB4HCDPh017150\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\n\tFri, 4 Dec 2009 12:12:13 -0500", "from localhost (vpn-11-221.rdu.redhat.com [10.11.11.221])\n\tby int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with\n\tESMTP id nB4HCCAF028656; Fri, 4 Dec 2009 12:12:13 -0500" ], "From": "Luiz Capitulino <lcapitulino@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 4 Dec 2009 15:11:32 -0200", "Message-Id": "<1259946695-15784-15-git-send-email-lcapitulino@redhat.com>", "In-Reply-To": "<1259946695-15784-1-git-send-email-lcapitulino@redhat.com>", "References": "<1259946695-15784-1-git-send-email-lcapitulino@redhat.com>", "X-Scanned-By": "MIMEDefang 2.67 on 10.5.11.11", "X-detected-operating-system": "by monty-python.gnu.org: Genre and OS details\n\tnot recognized.", "Cc": "aliguori@us.ibm.com", "Subject": "[Qemu-devel] [PATCH 14/17] block: Convert bdrv_info_stats() to\n\tQObject", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.5", "Precedence": "list", "List-Id": "qemu-devel.nongnu.org", "List-Unsubscribe": "<http://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.gnu.org/pipermail/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<http://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Each device statistic information is stored in a QDict and\nthe returned QObject is a QList of all devices.\n\nThis commit should not change user output.\n\nSigned-off-by: Luiz Capitulino <lcapitulino@redhat.com>\n---\n block.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------\n block.h | 3 +-\n monitor.c | 3 +-\n 3 files changed, 75 insertions(+), 13 deletions(-)", "diff": "diff --git a/block.c b/block.c\nindex f0cabaa..d7c8547 100644\n--- a/block.c\n+++ b/block.c\n@@ -1261,22 +1261,82 @@ void bdrv_info(Monitor *mon, QObject **ret_data)\n *ret_data = QOBJECT(bs_list);\n }\n \n-/* The \"info blockstats\" command. */\n-void bdrv_info_stats(Monitor *mon)\n+static void bdrv_stats_iter(QObject *data, void *opaque)\n {\n+ QDict *qdict;\n+ Monitor *mon = opaque;\n+\n+ qdict = qobject_to_qdict(data);\n+ monitor_printf(mon, \"%s:\", qdict_get_str(qdict, \"device\"));\n+\n+ qdict = qobject_to_qdict(qdict_get(qdict, \"stats\"));\n+ monitor_printf(mon, \" rd_bytes=%\" PRId64\n+ \" wr_bytes=%\" PRId64\n+ \" rd_operations=%\" PRId64\n+ \" wr_operations=%\" PRId64\n+ \"\\n\",\n+ qdict_get_int(qdict, \"rd_bytes\"),\n+ qdict_get_int(qdict, \"wr_bytes\"),\n+ qdict_get_int(qdict, \"rd_operations\"),\n+ qdict_get_int(qdict, \"wr_operations\"));\n+}\n+\n+void bdrv_stats_print(Monitor *mon, const QObject *data)\n+{\n+ qlist_iter(qobject_to_qlist(data), bdrv_stats_iter, mon);\n+}\n+\n+/**\n+ * bdrv_info_stats(): show block device statistics\n+ *\n+ * Each device statistic information is stored in a QDict and\n+ * the returned QObject is a QList of all devices.\n+ *\n+ * The QDict contains the following:\n+ *\n+ * - \"device\": device name\n+ * - \"stats\": QDict with the stats information, contains:\n+ * - \"rd_bytes\": bytes read\n+ * - \"wr_bytes\": bytes written\n+ * - \"rd_operations\": read operations\n+ * - \"wr_operations\": write operations\n+ * \n+ * Example:\n+ *\n+ * [ { \"device\": \"ide0-hd0\",\n+ * \"stats\": { \"rd_bytes\": 512,\n+ * \"wr_bytes\": 0,\n+ * \"rd_operations\": 1,\n+ * \"wr_operations\": 0 } },\n+ * { \"device\": \"ide1-cd0\",\n+ * \"stats\": { \"rd_bytes\": 0,\n+ * \"wr_bytes\": 0,\n+ * \"rd_operations\": 0,\n+ * \"wr_operations\": 0 } } ]\n+ */\n+void bdrv_info_stats(Monitor *mon, QObject **ret_data)\n+{\n+ QObject *obj;\n+ QList *devices;\n BlockDriverState *bs;\n \n+ devices = qlist_new();\n+\n for (bs = bdrv_first; bs != NULL; bs = bs->next) {\n- monitor_printf(mon, \"%s:\"\n- \" rd_bytes=%\" PRIu64\n- \" wr_bytes=%\" PRIu64\n- \" rd_operations=%\" PRIu64\n- \" wr_operations=%\" PRIu64\n- \"\\n\",\n- bs->device_name,\n- bs->rd_bytes, bs->wr_bytes,\n- bs->rd_ops, bs->wr_ops);\n- }\n+ obj = qobject_from_jsonf(\"{ 'device': %s, 'stats': {\"\n+ \"'rd_bytes': %\" PRId64 \",\"\n+ \"'wr_bytes': %\" PRId64 \",\"\n+ \"'rd_operations': %\" PRId64 \",\"\n+ \"'wr_operations': %\" PRId64\n+ \"} }\",\n+ bs->device_name,\n+ bs->rd_bytes, bs->wr_bytes,\n+ bs->rd_ops, bs->wr_ops);\n+ assert(obj != NULL);\n+ qlist_append_obj(devices, obj);\n+ }\n+\n+ *ret_data = QOBJECT(devices);\n }\n \n const char *bdrv_get_encrypted_filename(BlockDriverState *bs)\ndiff --git a/block.h b/block.h\nindex 3282dd2..fa51ddf 100644\n--- a/block.h\n+++ b/block.h\n@@ -48,7 +48,8 @@ typedef struct QEMUSnapshotInfo {\n \n void bdrv_info_print(Monitor *mon, const QObject *data);\n void bdrv_info(Monitor *mon, QObject **ret_data);\n-void bdrv_info_stats(Monitor *mon);\n+void bdrv_stats_print(Monitor *mon, const QObject *data);\n+void bdrv_info_stats(Monitor *mon, QObject **ret_data);\n \n void bdrv_init(void);\n void bdrv_init_with_whitelist(void);\ndiff --git a/monitor.c b/monitor.c\nindex 8b42f9b..bd1e045 100644\n--- a/monitor.c\n+++ b/monitor.c\n@@ -2255,7 +2255,8 @@ static const mon_cmd_t info_cmds[] = {\n .args_type = \"\",\n .params = \"\",\n .help = \"show block device statistics\",\n- .mhandler.info = bdrv_info_stats,\n+ .user_print = bdrv_stats_print,\n+ .mhandler.info_new = bdrv_info_stats,\n },\n {\n .name = \"registers\",\n", "prefixes": [ "14/17" ] }