aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-data.c
diff options
context:
space:
mode:
authorYunlong Song <yunlong.song@huawei.com>2015-04-02 21:47:19 +0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-02 13:18:52 -0300
commitbd05954bfa17f03a7bd4454178ba09786b35e383 (patch)
tree1b18a69e1086a649e45056db50b90392983f05a5 /tools/perf/builtin-data.c
parentperf trace: Support using -f to override perf.data file ownership (diff)
downloadlinux-dev-bd05954bfa17f03a7bd4454178ba09786b35e383.tar.xz
linux-dev-bd05954bfa17f03a7bd4454178ba09786b35e383.zip
perf data: Support using -f to override perf.data file ownership for 'convert'
Enable perf data convert to use perf.data when it is not owned by current user or root. Example: # perf record ls # chown Yunlong.Song:Yunlong.Song perf.data # ls -al perf.data -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr 2 17:35 perf.data # id uid=0(root) gid=0(root) groups=0(root),64(pkcs11) Before this patch: # perf data convert --to-ctf=./ctf-data/ File perf.data not owned by current user or root (use -f to override) # perf data convert --to-ctf=./ctf-data/ -f Error: unknown switch `f' usage: perf data convert [<options>] -v, --verbose be more verbose -i, --input <file> input file name --to-ctf ... Convert to CTF format After this patch: # perf data convert --to-ctf=./ctf-data/ File perf.data not owned by current user or root (use -f to override) # perf data convert --to-ctf=./ctf-data/ -f # ls ctf-data/ metadata perf_stream_0 As shown above, the -f option really works now. Signed-off-by: Yunlong Song <yunlong.song@huawei.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1427982439-27388-11-git-send-email-yunlong.song@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-data.c')
-rw-r--r--tools/perf/builtin-data.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
index 709152a7b408..d6525bc54d13 100644
--- a/tools/perf/builtin-data.c
+++ b/tools/perf/builtin-data.c
@@ -53,12 +53,14 @@ static int cmd_data_convert(int argc, const char **argv,
const char *prefix __maybe_unused)
{
const char *to_ctf = NULL;
+ bool force = false;
const struct option options[] = {
OPT_INCR('v', "verbose", &verbose, "be more verbose"),
OPT_STRING('i', "input", &input_name, "file", "input file name"),
#ifdef HAVE_LIBBABELTRACE_SUPPORT
OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"),
#endif
+ OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
OPT_END()
};
@@ -76,7 +78,7 @@ static int cmd_data_convert(int argc, const char **argv,
if (to_ctf) {
#ifdef HAVE_LIBBABELTRACE_SUPPORT
- return bt_convert__perf2ctf(input_name, to_ctf);
+ return bt_convert__perf2ctf(input_name, to_ctf, force);
#else
pr_err("The libbabeltrace support is not compiled in.\n");
return -1;