From 46e201efa15b70ec39df5237116fddebb4f5057c Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Fri, 4 Oct 2019 11:31:20 +0300 Subject: perf data: Support single perf.data file directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support directory output that contains a regular perf.data file, named "data". By default the directory is named perf.data i.e. perf.data └── data Most of the infrastructure to support a directory is already there. This patch makes the changes needed to support the format above. Presently there is no 'perf record' option to output a directory. This is preparation for adding support for putting a copy of /proc/kcore in the directory. Signed-off-by: Adrian Hunter Reviewed-by: Jiri Olsa Link: http://lore.kernel.org/lkml/20191004083121.12182-5-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/data.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/perf/util/data.h') diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h index 218fe9a16801..f68815f7e428 100644 --- a/tools/perf/util/data.h +++ b/tools/perf/util/data.h @@ -10,6 +10,7 @@ enum perf_data_mode { }; enum perf_dir_version { + PERF_DIR_SINGLE_FILE = 0, PERF_DIR_VERSION = 1, }; @@ -54,6 +55,11 @@ static inline bool perf_data__is_dir(struct perf_data *data) return data->is_dir; } +static inline bool perf_data__is_single_file(struct perf_data *data) +{ + return data->dir.version == PERF_DIR_SINGLE_FILE; +} + static inline int perf_data__fd(struct perf_data *data) { return data->file.fd; -- cgit