From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 02/13] perf trace: Separate tp syscall field caching into init routine to be reused
Date: Tue, 12 Nov 2013 17:46:07 -0300 [thread overview]
Message-ID: <1384289178-31374-3-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1384289178-31374-1-git-send-email-acme@infradead.org>
From: Namhyung Kim <namhyung@kernel.org>
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 aeb6296a76bd..3fa1dce6d43e 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;
--
1.8.1.4
next prev parent reply other threads:[~2013-11-12 20:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 20:46 [GIT PULL 00/13] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 01/13] perf trace: Beautify fifth argument of mmap() as fd Arnaldo Carvalho de Melo
2013-11-12 20:46 ` Arnaldo Carvalho de Melo [this message]
2013-11-12 20:46 ` [PATCH 03/13] perf trace: Fix segfault on perf trace -i perf.data Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 04/13] perf tests: Compensate lower sample freq with longer test loop Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 05/13] perf trace: Change syscall summary duration order Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 06/13] perf trace: Simplify '--summary' output Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 07/13] perf trace: Add summary only option Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 08/13] perf record: Fix segfault with --no-mmap-pages Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 09/13] perf evlist: Round mmap pages to power 2 - v2 Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 10/13] perf evlist: Refactor mmap_pages parsing Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 11/13] perf tests: Handle throttle events in 'object code reading' test Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 12/13] perf target: Shorten perf_target__ to target__ Arnaldo Carvalho de Melo
2013-11-12 20:46 ` [PATCH 13/13] tools lib traceevent: Add direct access to dynamic arrays Arnaldo Carvalho de Melo
2013-11-12 20:50 ` [GIT PULL 00/13] perf/core improvements and fixes Ingo Molnar
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=1384289178-31374-3-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--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=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).