public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ftrace: support binary record
Date: Wed, 10 Dec 2008 12:49:31 +0800	[thread overview]
Message-ID: <493F4A5B.6090009@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0812092307040.25755@gandalf.stny.rr.com>

Steven Rostedt wrote:
> 
> 
> On Wed, 10 Dec 2008, Lai Jiangshan wrote:
> 
>> Binary record will save memory in trace buffer, and more events
>> can be recorded in buffer.
>>
>> This patch add infrastructure for supporting binary record.
>>
>> This infrastructure records events by binary and shows events
>> by human readable text.
> 
> Hmm, interesting. But could you show an example of its use. It is quite a 
> lot of code, and looks a little complex.
consider ftrace_struct_printk() as ftrace_printk(), but the
first parameter is "struct ftrace_struct *fmt"

new file: kernel/trace/trace_struct.c : this infrastructure's code

lib/vsprintf.c : formator
other files add ftrace_struct_printk()

> 
>> And add a API ftrace_struct_printk() using this infrastructure.
>> (it's like ftrace_printk(), but it record the date by binary)
>>


example:
...
           <...>-3246  [000]  1243.166054: sys_read: sys_read by ftrace_printk, 3, asdfuuuuu
           <...>-3246  [000]  1243.166057: sys_read: sys_read by ftrace_struct_printk, 3, asdfuuuuu
           <...>-3246  [000]  1243.166490: sys_read: sys_read by ftrace_printk, 9, asdfuuuuu
           <...>-3246  [000]  1243.166491: sys_read: sys_read by ftrace_struct_printk, 9, asdfuuuuu
...
diff --git a/fs/read_write.c b/fs/read_write.c
index 969a6d9..0d9fbed 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -17,7 +17,7 @@
 #include <linux/pagemap.h>
 #include <linux/splice.h>
 #include "read_write.h"
-
+#include <linux/ftrace.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 
@@ -356,12 +356,15 @@ static inline void file_pos_write(struct file *file, loff_t pos)
 	file->f_pos = pos;
 }
 
+struct ftrace_struct test = {"ixxs", "sys_read by ftrace_struct_printk, %d, %s\n"};
 asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
 {
 	struct file *file;
 	ssize_t ret = -EBADF;
 	int fput_needed;
 
+	ftrace_printk("sys_read by ftrace_printk, %d, %s\n", fd, "asdfuuuuu");
+	ftrace_struct_printk(&test, fd, "asdfuuuuu");
 	file = fget_light(fd, &fput_needed);
 	if (file) {
 		loff_t pos = file_pos_read(file);


  reply	other threads:[~2008-12-10  4:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10  3:22 [PATCH] ftrace: support binary record Lai Jiangshan
2008-12-10  4:21 ` Steven Rostedt
2008-12-10  4:49   ` Lai Jiangshan [this message]
2008-12-10  5:17   ` Lai Jiangshan

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=493F4A5B.6090009@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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