* [PATCH 3/3] trace_kprobes: don't output zero offset
@ 2009-11-25 8:33 Lai Jiangshan
2009-11-25 13:00 ` Masami Hiramatsu
2009-11-27 5:50 ` [tip:perf/core] trace_kprobes: Don't " tip-bot for Lai Jiangshan
0 siblings, 2 replies; 3+ messages in thread
From: Lai Jiangshan @ 2009-11-25 8:33 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, Masami Hiramatsu, LKML
"symbol_name+0" is not so friendly.
It makes the output longer.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 9e42f2a..e82bea3 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -243,7 +243,11 @@ static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
ret = snprintf(buf, n, "@0x%p", ff->data);
else if (ff->func == fetch_symbol) {
struct symbol_cache *sc = ff->data;
- ret = snprintf(buf, n, "@%s%+ld", sc->symbol, sc->offset);
+ if (sc->offset)
+ ret = snprintf(buf, n, "@%s%+ld", sc->symbol,
+ sc->offset);
+ else
+ ret = snprintf(buf, n, "@%s", sc->symbol);
} else if (ff->func == fetch_retvalue)
ret = snprintf(buf, n, "$retval");
else if (ff->func == fetch_stack_address)
@@ -760,10 +764,12 @@ static int probes_seq_show(struct seq_file *m, void *v)
seq_printf(m, "%c", probe_is_return(tp) ? 'r' : 'p');
seq_printf(m, ":%s/%s", tp->call.system, tp->call.name);
- if (tp->symbol)
+ if (!tp->symbol)
+ seq_printf(m, " 0x%p", tp->rp.kp.addr);
+ else if (tp->rp.kp.offset)
seq_printf(m, " %s+%u", probe_symbol(tp), tp->rp.kp.offset);
else
- seq_printf(m, " 0x%p", tp->rp.kp.addr);
+ seq_printf(m, " %s", probe_symbol(tp));
for (i = 0; i < tp->nr_args; i++) {
ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i].fetch);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 3/3] trace_kprobes: don't output zero offset
2009-11-25 8:33 [PATCH 3/3] trace_kprobes: don't output zero offset Lai Jiangshan
@ 2009-11-25 13:00 ` Masami Hiramatsu
2009-11-27 5:50 ` [tip:perf/core] trace_kprobes: Don't " tip-bot for Lai Jiangshan
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2009-11-25 13:00 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Ingo Molnar, Steven Rostedt, Frederic Weisbecker, LKML
Hi Lai,
Lai Jiangshan wrote:
>
> "symbol_name+0" is not so friendly.
> It makes the output longer.
Hmm, I've added +0 just for convenience of parser programs.
But anyway, skipping it is not so costly option for them :-)
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 9e42f2a..e82bea3 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -243,7 +243,11 @@ static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
> ret = snprintf(buf, n, "@0x%p", ff->data);
> else if (ff->func == fetch_symbol) {
> struct symbol_cache *sc = ff->data;
> - ret = snprintf(buf, n, "@%s%+ld", sc->symbol, sc->offset);
> + if (sc->offset)
> + ret = snprintf(buf, n, "@%s%+ld", sc->symbol,
> + sc->offset);
> + else
> + ret = snprintf(buf, n, "@%s", sc->symbol);
> } else if (ff->func == fetch_retvalue)
> ret = snprintf(buf, n, "$retval");
> else if (ff->func == fetch_stack_address)
> @@ -760,10 +764,12 @@ static int probes_seq_show(struct seq_file *m, void *v)
> seq_printf(m, "%c", probe_is_return(tp) ? 'r' : 'p');
> seq_printf(m, ":%s/%s", tp->call.system, tp->call.name);
>
> - if (tp->symbol)
> + if (!tp->symbol)
> + seq_printf(m, " 0x%p", tp->rp.kp.addr);
> + else if (tp->rp.kp.offset)
> seq_printf(m, " %s+%u", probe_symbol(tp), tp->rp.kp.offset);
> else
> - seq_printf(m, " 0x%p", tp->rp.kp.addr);
> + seq_printf(m, " %s", probe_symbol(tp));
>
> for (i = 0; i < tp->nr_args; i++) {
> ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i].fetch);
>
>
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com
^ permalink raw reply [flat|nested] 3+ messages in thread* [tip:perf/core] trace_kprobes: Don't output zero offset
2009-11-25 8:33 [PATCH 3/3] trace_kprobes: don't output zero offset Lai Jiangshan
2009-11-25 13:00 ` Masami Hiramatsu
@ 2009-11-27 5:50 ` tip-bot for Lai Jiangshan
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Lai Jiangshan @ 2009-11-27 5:50 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, fweisbec, rostedt, tglx, laijs,
mhiramat, mingo
Commit-ID: 52a11f354970e7301e1d1a029b87535be45abec9
Gitweb: http://git.kernel.org/tip/52a11f354970e7301e1d1a029b87535be45abec9
Author: Lai Jiangshan <laijs@cn.fujitsu.com>
AuthorDate: Wed, 25 Nov 2009 16:33:15 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 27 Nov 2009 06:43:05 +0100
trace_kprobes: Don't output zero offset
"symbol_name+0" is not so friendly.
It makes the output longer.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4B0CEBCB.7080309@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/trace/trace_kprobe.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 96e1944..72d0c65 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -243,7 +243,11 @@ static int probe_arg_string(char *buf, size_t n, struct fetch_func *ff)
ret = snprintf(buf, n, "@0x%p", ff->data);
else if (ff->func == fetch_symbol) {
struct symbol_cache *sc = ff->data;
- ret = snprintf(buf, n, "@%s%+ld", sc->symbol, sc->offset);
+ if (sc->offset)
+ ret = snprintf(buf, n, "@%s%+ld", sc->symbol,
+ sc->offset);
+ else
+ ret = snprintf(buf, n, "@%s", sc->symbol);
} else if (ff->func == fetch_retvalue)
ret = snprintf(buf, n, "$retval");
else if (ff->func == fetch_stack_address)
@@ -762,10 +766,12 @@ static int probes_seq_show(struct seq_file *m, void *v)
seq_printf(m, "%c", probe_is_return(tp) ? 'r' : 'p');
seq_printf(m, ":%s/%s", tp->call.system, tp->call.name);
- if (tp->symbol)
+ if (!tp->symbol)
+ seq_printf(m, " 0x%p", tp->rp.kp.addr);
+ else if (tp->rp.kp.offset)
seq_printf(m, " %s+%u", probe_symbol(tp), tp->rp.kp.offset);
else
- seq_printf(m, " 0x%p", tp->rp.kp.addr);
+ seq_printf(m, " %s", probe_symbol(tp));
for (i = 0; i < tp->nr_args; i++) {
ret = probe_arg_string(buf, MAX_ARGSTR_LEN, &tp->args[i].fetch);
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-27 5:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 8:33 [PATCH 3/3] trace_kprobes: don't output zero offset Lai Jiangshan
2009-11-25 13:00 ` Masami Hiramatsu
2009-11-27 5:50 ` [tip:perf/core] trace_kprobes: Don't " tip-bot for Lai Jiangshan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.