From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPW5L-00044d-N7 for qemu-devel@nongnu.org; Tue, 09 Apr 2013 06:47:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPW5I-00064E-IA for qemu-devel@nongnu.org; Tue, 09 Apr 2013 06:47:31 -0400 Received: from mail4.hitachi.co.jp ([133.145.228.5]:60754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPW5I-000644-2v for qemu-devel@nongnu.org; Tue, 09 Apr 2013 06:47:28 -0400 Message-ID: <5163F1BB.4070000@hitachi.com> Date: Tue, 09 Apr 2013 19:47:23 +0900 From: Eiichi Tsukata MIME-Version: 1.0 References: <1364970659-5715-1-git-send-email-eiichi.tsukata.xh@hitachi.com> <1364970659-5715-2-git-send-email-eiichi.tsukata.xh@hitachi.com> <20130408141054.GE4429@stefanha-thinkpad.redhat.com> In-Reply-To: <20130408141054.GE4429@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, stefanha@redhat.com, yrl.pp-manager.tt@hitachi.com Hello Stefan, Thank you for reviewing my patch. (2013/04/08 23:10), Stefan Hajnoczi wrote: > 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" >> +__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. I see, I'll fix it up. > >> + 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. > Sounds good. I'll use snprintf(3) return value in V2 patch and send it soon. Eiichi > Stefan > . >