path: root/tools/perf/builtin-evlist.c
diff options
authorYunlong Song <>2015-04-02 21:47:10 +0800
committerArnaldo Carvalho de Melo <>2015-04-02 13:18:45 -0300
commit9e3b6ec17374299516d83c2e36135b958a895aa3 (patch)
treedc5edf92267d786df87b410e58296c44a365a1e6 /tools/perf/builtin-evlist.c
parentc72738355b2ac79506fbfa10ffee8fe3a27e69da (diff)
perf evlist: Support using -f to override file ownership
Enable perf evlist to use when it is not owned by current user or root. Example: # perf record ls # chown Yunlong.Song:Yunlong.Song # ls -al -rw------- 1 Yunlong.Song Yunlong.Song 28260 Apr 2 10:18 # id uid=0(root) gid=0(root) groups=0(root),64(pkcs11) Before this patch: # perf evlist File not owned by current user or root (use -f to override) # perf evlist -f Error: unknown switch `f' usage: perf evlist [<options>] -i, --input <file> Input file name -F, --freq Show the sample frequency -v, --verbose Show all event attr details -g, --group Show event group information As shown above, the -f option does not work at all. After this patch: # perf evlist File not owned by current user or root (use -f to override) # perf evlist -f cycles As shown above, the -f option really works now. Signed-off-by: Yunlong Song <> Tested-by: Arnaldo Carvalho de Melo <> Cc: Paul Mackerras <> Cc: Peter Zijlstra <> Cc: Wang Nan <> Link: Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools/perf/builtin-evlist.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
index 0f93f859b782..695ec5a50cf2 100644
--- a/tools/perf/builtin-evlist.c
+++ b/tools/perf/builtin-evlist.c
@@ -24,6 +24,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
struct perf_data_file file = {
.path = file_name,
+ .force = details->force,
session = perf_session__new(&file, 0, NULL);
@@ -47,6 +48,7 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
"Show all event attr details"),
OPT_BOOLEAN('g', "group", &details.event_group,
"Show event group information"),
+ OPT_BOOLEAN('f', "force", &details.force, "don't complain, do it"),
const char * const evlist_usage[] = {