From: Stefan Hajnoczi <stefanha@gmail.com>
To: Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend
Date: Mon, 8 Apr 2013 16:10:54 +0200 [thread overview]
Message-ID: <20130408141054.GE4429@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1364970659-5715-2-git-send-email-eiichi.tsukata.xh@hitachi.com>
On Wed, Apr 03, 2013 at 03:30:58PM +0900, Eiichi Tsukata wrote:
> diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
> new file mode 100644
> index 0000000..e02f0ca
> --- /dev/null
> +++ b/scripts/tracetool/backend/ftrace.py
> @@ -0,0 +1,53 @@
> +#!/usr/bin/env python
> +# -*- coding: utf-8 -*-
> +
> +"""
> +Ftrace built-in backend.
> +"""
> +
> +__author__ = "Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>"
> +__copyright__ = "Copyright (C) 2013 Hitachi, Ltd."
> +__license__ = "GPL version 2 or (at your option) any later version"
> +
> +__maintainer__ = "Stefan Hajnoczi"
> +__email__ = "stefanha@linux.vnet.ibm.com"
My email is now stefanha@redhat.com. I can fix this up when merging the
patch.
> + out('static inline void trace_%(name)s(%(args)s)',
> + '{',
> + ' char ftrace_buf[MAX_TRACE_STRLEN];',
> + ' int unused __attribute__ ((unused));'
> + ' bool _state = trace_event_get_state(%(event_id)s);',
> + ' if (_state) {',
> + ' snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
> + ' "%(name)s " %(fmt)s "\\n" %(argnames)s);',
> + ' unused = write(trace_marker_fd, ftrace_buf,',
> + ' MAX_TRACE_STRLEN);',
Looking at kernel/trace/trace.c:tracing_mark_write() the kernel will
memcpy() the full number of bytes we give.
You could use the snprintf(3) return value (number of characters
written, excluding NUL byte).
I think that would waste less trace buffer space.
Stefan
next prev parent reply other threads:[~2013-04-08 14:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-03 6:30 [Qemu-devel] [PATCH 0/2] New trace backend: ftrace Eiichi Tsukata
2013-04-03 6:30 ` [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend Eiichi Tsukata
2013-04-08 14:10 ` Stefan Hajnoczi [this message]
2013-04-09 10:47 ` Eiichi Tsukata
2013-04-03 6:30 ` [Qemu-devel] [PATCH 2/2] trace: document frace backend Eiichi Tsukata
2013-04-08 14:12 ` [Qemu-devel] [PATCH 0/2] New trace backend: ftrace Stefan Hajnoczi
-- strict thread matches above, loose matches on Subject: below --
2013-04-03 3:41 Eiichi Tsukata
2013-04-03 3:41 ` [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend Eiichi Tsukata
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=20130408141054.GE4429@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=eiichi.tsukata.xh@hitachi.com \
--cc=qemu-devel@nongnu.org \
/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).