aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/data.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-03-08 14:47:35 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-03-11 11:56:03 -0300
commitec65def1045e4c7817b7f741a86dadae82877a93 (patch)
tree00dd535975e20950a1fa9a348f9615010be72030 /tools/perf/util/data.h
parentperf vendor events amd: perf PMU events for AMD Family 17h (diff)
downloadlinux-dev-ec65def1045e4c7817b7f741a86dadae82877a93.tar.xz
linux-dev-ec65def1045e4c7817b7f741a86dadae82877a93.zip
perf data: Support having perf.data stored as a directory
The caller needs to set 'struct perf_data::is_dir flag and the path will be treated as a directory. The 'struct perf_data::file' is initialized and open as 'path/header' file. Add a check to the direcory interface functions to check the is_dir flag. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20190308134745.5057-2-jolsa@kernel.org [ Be consistent on how to signal failure, i.e. use -1 and let users check errno ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/data.h')
-rw-r--r--tools/perf/util/data.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h
index 14b47be2bd69..06aefeda311f 100644
--- a/tools/perf/util/data.h
+++ b/tools/perf/util/data.h
@@ -19,6 +19,7 @@ struct perf_data {
const char *path;
struct perf_data_file file;
bool is_pipe;
+ bool is_dir;
bool force;
enum perf_data_mode mode;
@@ -43,6 +44,11 @@ static inline int perf_data__is_pipe(struct perf_data *data)
return data->is_pipe;
}
+static inline bool perf_data__is_dir(struct perf_data *data)
+{
+ return data->is_dir;
+}
+
static inline int perf_data__fd(struct perf_data *data)
{
return data->file.fd;