From patchwork Wed Dec 21 15:35:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 132675 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A2210B7135 for ; Thu, 22 Dec 2011 02:36:30 +1100 (EST) Received: from localhost ([::1]:57331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdODS-0008SU-Sa for incoming@patchwork.ozlabs.org; Wed, 21 Dec 2011 10:36:26 -0500 Received: from eggs.gnu.org ([140.186.70.92]:55289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdODM-0008SC-0j for qemu-devel@nongnu.org; Wed, 21 Dec 2011 10:36:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdODK-0004ti-Pi for qemu-devel@nongnu.org; Wed, 21 Dec 2011 10:36:19 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:49192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdODK-0004sc-5N for qemu-devel@nongnu.org; Wed, 21 Dec 2011 10:36:18 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Dec 2011 15:36:12 -0000 Received: from d06nrmr1407.portsmouth.uk.ibm.com ([9.149.38.185]) by e06smtp14.uk.ibm.com ([192.168.101.144]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Dec 2011 15:35:49 -0000 Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBLFZm521953928 for ; Wed, 21 Dec 2011 15:35:49 GMT Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBLFZmRl019850 for ; Wed, 21 Dec 2011 08:35:48 -0700 Received: from localhost (sig-9-145-146-249.de.ibm.com [9.145.146.249]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id pBLFZlUZ019833; Wed, 21 Dec 2011 08:35:48 -0700 From: Stefan Hajnoczi To: Date: Wed, 21 Dec 2011 15:35:42 +0000 Message-Id: <1324481742-23456-1-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.7.3 x-cbid: 11122115-1948-0000-0000-000000764AF9 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.110 Cc: Kevin Wolf , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] qemu-io: add option to enable tracing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It can be useful to enable QEMU tracing when trying out block layer interfaces via qemu-io. Tracing can be enabled using the new -t FILE option where the given file contains a list of trace events to enable (just like the qemu --trace events=FILE option). $ echo qemu_vfree >my-events $ ./qemu-io -t my-events ... Remember to use ./configure --enable-trace-backend=BACKEND when building qemu-io. Signed-off-by: Stefan Hajnoczi --- qemu-io.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index ffa62fb..ad91fd6 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -17,6 +17,7 @@ #include "qemu-common.h" #include "block_int.h" #include "cmd.h" +#include "trace/control.h" #define VERSION "0.0.1" @@ -1722,6 +1723,7 @@ static void usage(const char *name) " -g, --growable allow file to grow (only applies to protocols)\n" " -m, --misalign misalign allocations for O_DIRECT\n" " -k, --native-aio use kernel AIO implementation (on Linux only)\n" +" -t, --trace FILE enable trace events listed in the given file\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n" "\n", @@ -1733,7 +1735,7 @@ int main(int argc, char **argv) { int readonly = 0; int growable = 0; - const char *sopt = "hVc:rsnmgk"; + const char *sopt = "hVc:rsnmgkt:"; const struct option lopt[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, @@ -1745,6 +1747,7 @@ int main(int argc, char **argv) { "misalign", 0, NULL, 'm' }, { "growable", 0, NULL, 'g' }, { "native-aio", 0, NULL, 'k' }, + { "trace", 1, NULL, 't' }, { NULL, 0, NULL, 0 } }; int c; @@ -1776,6 +1779,9 @@ int main(int argc, char **argv) case 'k': flags |= BDRV_O_NATIVE_AIO; break; + case 't': + trace_backend_init(optarg, NULL); + break; case 'V': printf("%s version %s\n", progname, VERSION); exit(0);