qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend


From: Eiichi Tsukata
Subject: Re: [Qemu-devel] [PATCH 1/2] trace: Add ftrace tracing backend
Date: Tue, 09 Apr 2013 19:47:23 +0900
User-agent: Mozilla/5.0 (Windows NT 5.2; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

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<address@hidden>"
+__copyright__  = "Copyright (C) 2013 Hitachi, Ltd."
+__license__    = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__      = "address@hidden"

My email is now address@hidden  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
.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]