From: Prerna Saxena <prerna@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Maneesh Soni <maneesh@linux.vnet.ibm.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Ananth <ananth@linux.vnet.ibm.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 3/3] Samples to add a tracepoint.
Date: Mon, 24 May 2010 21:49:56 +0530 [thread overview]
Message-ID: <4BFAA72C.9030808@linux.vnet.ibm.com> (raw)
In-Reply-To: <4BFAA60D.6080308@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 585 bytes --]
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()
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
[-- Attachment #2: tp-samples.patch --]
[-- Type: text/x-diff, Size: 2821 bytes --]
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 <scsi/sg.h>
#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)
+)
next prev parent reply other threads:[~2010-05-24 16:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-24 16:05 [Qemu-devel] [RFC 0/3] Tracing framework for QEMU Prerna Saxena
2010-05-24 16:15 ` [Qemu-devel] [PATCH 1/3]make tdb_hash available Prerna Saxena
2010-05-24 16:16 ` [Qemu-devel] [PATCH 2/3] Tracepoint, buffer & monitor framework Prerna Saxena
2010-05-25 11:40 ` Stefan Hajnoczi
2010-05-25 18:20 ` Prerna Saxena
2010-05-25 20:07 ` Stefan Hajnoczi
2010-05-24 16:19 ` Prerna Saxena [this message]
2010-05-25 11:38 ` [Qemu-devel] [PATCH 3/3] Samples to add a tracepoint Stefan Hajnoczi
2010-05-25 11:43 ` [Qemu-devel] [RFC 0/3] Tracing framework for QEMU Stefan Hajnoczi
2010-06-08 8:35 ` Prerna Saxena
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=4BFAA72C.9030808@linux.vnet.ibm.com \
--to=prerna@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=maneesh@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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).