summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/data.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2019-10-04 11:31:20 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-11-06 15:43:05 -0300
commit46e201efa15b70ec39df5237116fddebb4f5057c (patch)
tree9aa984ba363bab12e5c52b25bace25675b3a00de /tools/perf/util/data.c
parent01e97a59ea3e071e5c60ad46c40b4db748bfe928 (diff)
downloadlinux-46e201efa15b70ec39df5237116fddebb4f5057c.tar.bz2
perf data: Support single perf.data file directory
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 <adrian.hunter@intel.com> Reviewed-by: Jiri Olsa <jolsa@kernel.org> Link: http://lore.kernel.org/lkml/20191004083121.12182-5-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/data.c')
-rw-r--r--tools/perf/util/data.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index df173f0bf654..964ea101dba6 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -76,6 +76,13 @@ int perf_data__open_dir(struct perf_data *data)
DIR *dir;
int nr = 0;
+ /*
+ * Directory containing a single regular perf data file which is already
+ * open, means there is nothing more to do here.
+ */
+ if (perf_data__is_single_file(data))
+ return 0;
+
if (WARN_ON(!data->is_dir))
return -EINVAL;
@@ -406,7 +413,7 @@ unsigned long perf_data__size(struct perf_data *data)
u64 size = data->file.size;
int i;
- if (!data->is_dir)
+ if (perf_data__is_single_file(data))
return size;
for (i = 0; i < data->dir.nr; i++) {