aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2021-07-19 15:31:50 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-08-02 10:09:05 -0300
commit0ae03893623dd1ddf17c1210265e5d7f9e2f3ed6 (patch)
tree2dc1ca5bf970e511191e025c1c4da4521a803622 /tools/perf/util/session.c
parentperf tools: Remove repipe argument from perf_session__new() (diff)
downloadlinux-dev-0ae03893623dd1ddf17c1210265e5d7f9e2f3ed6.tar.xz
linux-dev-0ae03893623dd1ddf17c1210265e5d7f9e2f3ed6.zip
perf tools: Pass a fd to perf_file_header__read_pipe()
Currently it unconditionally writes to stdout for repipe. But perf inject can direct its output to a regular file. Then it needs to write the header to the file as well. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210719223153.1618812-3-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 073c731f8a1a..d2e27ff96030 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -102,11 +102,11 @@ static int perf_session__deliver_event(struct perf_session *session,
struct perf_tool *tool,
u64 file_offset);
-static int perf_session__open(struct perf_session *session)
+static int perf_session__open(struct perf_session *session, int repipe_fd)
{
struct perf_data *data = session->data;
- if (perf_session__read_header(session) < 0) {
+ if (perf_session__read_header(session, repipe_fd) < 0) {
pr_err("incompatible file format (rerun with -v to learn more)\n");
return -1;
}
@@ -186,7 +186,7 @@ static int ordered_events__deliver_event(struct ordered_events *oe,
}
struct perf_session *__perf_session__new(struct perf_data *data,
- bool repipe,
+ bool repipe, int repipe_fd,
struct perf_tool *tool)
{
int ret = -ENOMEM;
@@ -211,7 +211,7 @@ struct perf_session *__perf_session__new(struct perf_data *data,
session->data = data;
if (perf_data__is_read(data)) {
- ret = perf_session__open(session);
+ ret = perf_session__open(session, repipe_fd);
if (ret < 0)
goto out_delete;