From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Yunlong Song <yunlong.song@huawei.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/15] perf evlist: Support using -f to override perf.data file ownership
Date: Thu, 2 Apr 2015 19:28:57 -0300 [thread overview]
Message-ID: <1428013746-2037-7-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1428013746-2037-1-git-send-email-acme@kernel.org>
From: Yunlong Song <yunlong.song@huawei.com>
Enable perf evlist 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 10:18 perf.data
# id
uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
Before this patch:
# perf evlist
File perf.data 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 perf.data 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 <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.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-2-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-evlist.c | 2 ++
tools/perf/util/evsel.h | 1 +
2 files changed, 3 insertions(+)
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,
.mode = PERF_DATA_MODE_READ,
+ .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"),
OPT_END()
};
const char * const evlist_usage[] = {
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index dcf202aebe9f..c5a43d6b13dc 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -335,6 +335,7 @@ struct perf_attr_details {
bool freq;
bool verbose;
bool event_group;
+ bool force;
};
int perf_evsel__fprintf(struct perf_evsel *evsel,
--
1.9.3
next prev parent reply other threads:[~2015-04-02 22:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-02 22:28 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-04-02 22:28 ` [PATCH 01/15] perf script: No need to lookup thread twice Arnaldo Carvalho de Melo
2015-04-02 22:28 ` [PATCH 02/15] perf scripting: No need to pass thread twice to the scripting callbacks Arnaldo Carvalho de Melo
2015-04-02 22:28 ` [PATCH 03/15] perf db-export: No need to pass thread twice to db_export__sample Arnaldo Carvalho de Melo
2015-04-02 22:28 ` [PATCH 04/15] perf db-export: No need to have ->thread twice in struct export_sample Arnaldo Carvalho de Melo
2015-04-02 22:28 ` [PATCH 05/15] perf probe: Fix to track down unnamed union/structure members Arnaldo Carvalho de Melo
2015-04-02 22:28 ` Arnaldo Carvalho de Melo [this message]
2015-04-02 22:28 ` [PATCH 07/15] perf inject: Support using -f to override perf.data file ownership Arnaldo Carvalho de Melo
2015-04-02 22:28 ` [PATCH 08/15] perf kmem: " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 09/15] perf kvm: Support using -f to override perf.data.guest " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 10/15] perf lock: Support using -f to override perf.data " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 11/15] perf mem: " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 12/15] perf script: " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 13/15] perf timechart: " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 14/15] perf trace: " Arnaldo Carvalho de Melo
2015-04-02 22:29 ` [PATCH 15/15] perf data: Support using -f to override perf.data file ownership for 'convert' Arnaldo Carvalho de Melo
2015-04-03 5:02 ` [GIT PULL 00/15] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428013746-2037-7-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulus@samba.org \
--cc=wangnan0@huawei.com \
--cc=yunlong.song@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).