linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Borislav Petkov <bp@suse.de>, David Ahern <dsahern@gmail.com>,
	Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH 09/21] perf tools: Introduce event_format__fprintf method
Date: Wed, 11 Feb 2015 18:09:03 -0300	[thread overview]
Message-ID: <1423688955-8094-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1423688955-8094-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The existing one, event_format__print() uses stdout unconditionally,
and 'perf trace' needs to use it to format into a file that may have
been set by the user, i.e. 'trace -o file.output'.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/n/tip-7l0mgm91hwg0bby00s5pse8r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/trace-event-parse.c | 12 +++++++++---
 tools/perf/util/trace-event.h       |  3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index c36636fd825b..25d6c737be3e 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -112,8 +112,8 @@ unsigned long long read_size(struct event_format *event, void *ptr, int size)
 	return pevent_read_number(event->pevent, ptr, size);
 }
 
-void event_format__print(struct event_format *event,
-			 int cpu, void *data, int size)
+void event_format__fprintf(struct event_format *event,
+			   int cpu, void *data, int size, FILE *fp)
 {
 	struct pevent_record record;
 	struct trace_seq s;
@@ -125,10 +125,16 @@ void event_format__print(struct event_format *event,
 
 	trace_seq_init(&s);
 	pevent_event_info(&s, event, &record);
-	trace_seq_do_printf(&s);
+	trace_seq_do_fprintf(&s, fp);
 	trace_seq_destroy(&s);
 }
 
+void event_format__print(struct event_format *event,
+			 int cpu, void *data, int size)
+{
+	return event_format__fprintf(event, cpu, data, size, stdout);
+}
+
 void parse_proc_kallsyms(struct pevent *pevent,
 			 char *file, unsigned int size __maybe_unused)
 {
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 52aaa19e1eb1..356629a30ca9 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -23,6 +23,9 @@ trace_event__tp_format(const char *sys, const char *name);
 
 int bigendian(void);
 
+void event_format__fprintf(struct event_format *event,
+			   int cpu, void *data, int size, FILE *fp);
+
 void event_format__print(struct event_format *event,
 			 int cpu, void *data, int size);
 
-- 
1.9.3


  parent reply	other threads:[~2015-02-11 21:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 21:08 [GIT PULL 00/21] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-02-11 21:08 ` [PATCH 01/21] perf test: Fix dso cache testcase Arnaldo Carvalho de Melo
2015-02-11 21:08 ` [PATCH 02/21] perf tests: Do not rely on dso__data_read_offset() to open dso Arnaldo Carvalho de Melo
2015-02-11 21:08 ` [PATCH 03/21] perf tools: Fix a dso open fail message Arnaldo Carvalho de Melo
2015-02-11 21:08 ` [PATCH 04/21] perf probe: Fix to handle optimized not-inlined functions Arnaldo Carvalho de Melo
2015-02-11 21:08 ` [PATCH 05/21] perf probe: Update man page Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 06/21] perf symbols: Ignore mapping symbols on aarch64 Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 07/21] perf symbols: debuglink should take symfs option into account Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 08/21] tools lib traceevent: Introduce trace_seq_do_fprintf function Arnaldo Carvalho de Melo
2015-02-11 21:09 ` Arnaldo Carvalho de Melo [this message]
2015-02-11 21:09 ` [PATCH 10/21] perf trace: No need to enable evsels for workload started from perf Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 11/21] perf evlist: Fix typo in comment Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 12/21] perf tools: Do not check debugfs MAGIC for tracing files Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 13/21] tools lib fs: Add helper to find mounted file systems Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 14/21] tools lib api fs: Add tracefs mount helper functions Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 15/21] tools lib api debugfs: Add DEBUGFS_DEFAULT_PATH macro Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 16/21] tools lib api fs: Add {tracefs,debugfs}_configured() functions Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 17/21] perf tools: Make perf aware of tracefs Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 19/21] perf buildid-cache: Remove unneeded debugdir parameters Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 20/21] perf buildid-cache: Consolidate .build-id cache path generators Arnaldo Carvalho de Melo
2015-02-11 21:09 ` [PATCH 21/21] perf tools: Define _GNU_SOURCE on pthread_attr_setaffinity_np feature check Arnaldo Carvalho de Melo
2015-03-05  4:30 ` [GIT PULL 00/21] perf/core improvements and fixes Victor Kamensky
2015-03-05  6:37   ` Ingo Molnar
2015-03-05  6:49     ` Victor Kamensky

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=1423688955-8094-10-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.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=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).