From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
eranian@google.com, paulus@samba.org, hpa@zytor.com,
mingo@kernel.org, peterz@infradead.org, efault@gmx.de,
namhyung@kernel.org, jolsa@redhat.com, fweisbec@gmail.com,
adrian.hunter@intel.com, dsahern@gmail.com, tglx@linutronix.de
Subject: [tip:perf/urgent] perf trace: Separate tp syscall field caching into init routine to be reused
Date: Tue, 12 Nov 2013 13:56:13 -0800 [thread overview]
Message-ID: <tip-96695d440242aca871ef8d797bd98d9cbd7ad8a0@git.kernel.org> (raw)
In-Reply-To: <20131112115700.GC4053@ghostprotocols.net>
Commit-ID: 96695d440242aca871ef8d797bd98d9cbd7ad8a0
Gitweb: http://git.kernel.org/tip/96695d440242aca871ef8d797bd98d9cbd7ad8a0
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 12 Nov 2013 08:51:45 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Nov 2013 13:00:36 -0300
perf trace: Separate tp syscall field caching into init routine to be reused
We need to set this in evsels coming out of a perf.data file header, not
just for new ones created for live sessions.
So separate the code that caches the syscall entry/exit tracepoint
format fields into a new function that will be used in the next
changeset.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20131112115700.GC4053@ghostprotocols.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index aeb6296..3fa1dce 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -149,20 +149,32 @@ static void perf_evsel__delete_priv(struct perf_evsel *evsel)
perf_evsel__delete(evsel);
}
+static int perf_evsel__init_syscall_tp(struct perf_evsel *evsel, void *handler)
+{
+ evsel->priv = malloc(sizeof(struct syscall_tp));
+ if (evsel->priv != NULL) {
+ if (perf_evsel__init_sc_tp_uint_field(evsel, id))
+ goto out_delete;
+
+ evsel->handler = handler;
+ return 0;
+ }
+
+ return -ENOMEM;
+
+out_delete:
+ free(evsel->priv);
+ evsel->priv = NULL;
+ return -ENOENT;
+}
+
static struct perf_evsel *perf_evsel__syscall_newtp(const char *direction, void *handler)
{
struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction);
if (evsel) {
- evsel->priv = malloc(sizeof(struct syscall_tp));
-
- if (evsel->priv == NULL)
+ if (perf_evsel__init_syscall_tp(evsel, handler))
goto out_delete;
-
- if (perf_evsel__init_sc_tp_uint_field(evsel, id))
- goto out_delete;
-
- evsel->handler = handler;
}
return evsel;
next prev parent reply other threads:[~2013-11-12 22:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 6:24 [PATCH 1/2] perf trace: Beautify fifth argument of mmap() as fd Namhyung Kim
2013-11-12 6:25 ` [PATCH 2/2] perf trace: Fix segfault on perf trace -i perf.data Namhyung Kim
2013-11-12 11:46 ` Arnaldo Carvalho de Melo
2013-11-12 11:57 ` Arnaldo Carvalho de Melo
2013-11-12 12:15 ` Arnaldo Carvalho de Melo
2013-11-12 21:31 ` Namhyung Kim
2013-11-12 21:27 ` Namhyung Kim
2013-11-12 13:23 ` Arnaldo Carvalho de Melo
2013-11-12 21:56 ` tip-bot for Namhyung Kim [this message]
2013-11-12 21:56 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2013-11-12 15:50 ` [PATCH 1/2] perf trace: Beautify fifth argument of mmap() as fd David Ahern
2013-11-12 21:56 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
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=tip-96695d440242aca871ef8d797bd98d9cbd7ad8a0@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome