From patchwork Mon May 24 16:19:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 53447 Return-Path: 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AC579B7D1A for ; Tue, 25 May 2010 02:43:26 +1000 (EST) Received: from localhost ([127.0.0.1]:47264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGakK-0000jb-10 for incoming@patchwork.ozlabs.org; Mon, 24 May 2010 12:43:20 -0400 Received: from [140.186.70.92] (port=37307 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGaSk-0005RK-05 for qemu-devel@nongnu.org; Mon, 24 May 2010 12:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGaSb-000283-MO for qemu-devel@nongnu.org; Mon, 24 May 2010 12:25:03 -0400 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:42614) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGaSb-00026A-57 for qemu-devel@nongnu.org; Mon, 24 May 2010 12:25:01 -0400 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [202.81.31.247]) by e23smtp04.au.ibm.com (8.14.3/8.13.1) with ESMTP id o4OGFsrx025697 for ; Tue, 25 May 2010 02:15:54 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o4OGJxiq1466454 for ; Tue, 25 May 2010 02:19:59 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o4OGJwCL001303 for ; Tue, 25 May 2010 02:19:59 +1000 Received: from [9.77.197.60] ([9.77.197.60]) by d23av01.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o4OGJuVY001300; Tue, 25 May 2010 02:19:57 +1000 Message-ID: <4BFAA72C.9030808@linux.vnet.ibm.com> Date: Mon, 24 May 2010 21:49:56 +0530 From: Prerna Saxena User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: qemu-devel@nongnu.org References: <4BFAA3BB.5030207@linux.vnet.ibm.com> <4BFAA60D.6080308@linux.vnet.ibm.com> In-Reply-To: <4BFAA60D.6080308@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Maneesh Soni , Anthony Liguori , Ananth , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 3/3] Samples to add a tracepoint. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Steps for adding a tracepoint : 1. In trace-entries.h, add a DECLARE_TRACE() in the said format. 2. In trace-entries.c: i) add a DEFINE_TRACE() for the tracepoint in the said format. ii) add an INIT_TRACE(name) for the tracepoint in the function init_tracepoints(void) 3. The call site should have a 'trace_name(args..)' (Remember to include "trace-entries.h" in the file where the tracepoint is logged) This patch adds tracepoints to virtio_blk_rw_complete() and paio_submit() Signed-off by : Prerna (prerna@linux.vnet.ibm.com) Index: qemu/hw/virtio-blk.c =================================================================== --- qemu.orig/hw/virtio-blk.c +++ qemu/hw/virtio-blk.c @@ -19,6 +19,10 @@ # include #endif +#ifdef CONFIG_QEMU_TRACE +#include "trace-entries.h" +#endif + typedef struct VirtIOBlock { VirtIODevice vdev; @@ -87,6 +91,8 @@ static void virtio_blk_rw_complete(void { VirtIOBlockReq *req = opaque; + trace_virtio_blk_rw_complete(req, ret); + if (ret) { int is_read = !(req->out->type & VIRTIO_BLK_T_OUT); if (virtio_blk_handle_rw_error(req, -ret, is_read)) Index: qemu/posix-aio-compat.c =================================================================== --- qemu.orig/posix-aio-compat.c +++ qemu/posix-aio-compat.c @@ -29,6 +29,9 @@ #include "block/raw-posix-aio.h" +#ifdef CONFIG_QEMU_TRACE +#include "trace-entries.h" +#endif struct qemu_paiocb { BlockDriverAIOCB common; @@ -565,6 +568,7 @@ BlockDriverAIOCB *paio_submit(BlockDrive { struct qemu_paiocb *acb; + trace_paio_submit(fd, sector_num); acb = qemu_aio_get(&raw_aio_pool, bs, cb, opaque); if (!acb) return NULL; Index: qemu/trace-entries.h =================================================================== --- qemu.orig/trace-entries.h +++ qemu/trace-entries.h @@ -29,5 +29,20 @@ void init_tracepoints(void); * ), * ) */ +DECLARE_TRACE(virtio_blk_rw_complete, + TP_PROTO(void* req, int ret), + TP_STRUCT__entry( + __field(void*, req); + __field(int, ret); + ) +) + +DECLARE_TRACE(paio_submit, + TP_PROTO(int fd, int64_t sector_num), + TP_STRUCT__entry( + __field(int, fd); + __field(int64_t, sector_num); + ) +) #endif /*__TRACE_ENTRIES_H__ */ Index: qemu/trace-entries.c =================================================================== --- qemu.orig/trace-entries.c +++ qemu/trace-entries.c @@ -20,7 +20,8 @@ void init_tracepoints(void) { // INIT_TRACE(foo); - + INIT_TRACE(virtio_blk_rw_complete); + INIT_TRACE(paio_submit); return; } @@ -37,4 +38,23 @@ void init_tracepoints(void) * ) * */ +DEFINE_TRACE( virtio_blk_rw_complete, + TP_PROTO(void* req, int ret), + TP_fast_assign( + __entry->req = req; + __entry->ret = ret; + ), + TP_printk("virtio_blk_rw_complete: req %p ret %d\n",__entry->req, + __entry->ret) +) + +DEFINE_TRACE( paio_submit, + TP_PROTO(int fd, int64_t sector_num), + TP_fast_assign( + __entry->fd = fd; + __entry->sector_num = sector_num; + ), + TP_printk("paio_submit: fd %d sector_num %ld\n",__entry->fd, + __entry->sector_num) +)