From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: mhiramat@kernel.org, jolsa@redhat.com, acme@redhat.com,
kstewart@linuxfoundation.org, tglx@linutronix.de,
pombredanne@nexb.com, linux-kernel@vger.kernel.org,
peterz@infradead.org, mingo@redhat.com,
alexander.shishkin@linux.intel.com, namhyung@kernel.org,
uneedsihyeon@gmail.com, kjlx@templeofstupid.com
Subject: Re: [PATCH v2 3/3] perf/buildid-cache: Support --purge-all option
Date: Mon, 23 Apr 2018 15:59:23 -0300 [thread overview]
Message-ID: <20180423185923.GB3788@kernel.org> (raw)
In-Reply-To: <20180417041346.5617-4-ravi.bangoria@linux.vnet.ibm.com>
Em Tue, Apr 17, 2018 at 09:43:46AM +0530, Ravi Bangoria escreveu:
> User can remove files from cache using --remove/--purge options
> but both needs list of files as an argument. It's not convenient
> when you want to flush out entire cache. Add an option to purge
> all files from cache.
>
> Ex,
> # perf buildid-cache -l
> 8a86ef73e44067bca52cc3f6cd3e5446c783391c /tmp/a.out
> ebe71fdcf4b366518cc154d570a33cd461a51c36 /tmp/a.out.1
> # perf buildid-cache -P -v
> Removing /tmp/a.out (8a86ef73e44067bca52cc3f6cd3e5446c783391c): Ok
> Removing /tmp/a.out.1 (ebe71fdcf4b366518cc154d570a33cd461a51c36): Ok
> Purged all: Ok
>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
> ---
> tools/perf/Documentation/perf-buildid-cache.txt | 3 +++
> tools/perf/builtin-buildid-cache.c | 36 ++++++++++++++++++++++++-
> 2 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt
> index 3f285ba6e1f9..f6de0952ff3c 100644
> --- a/tools/perf/Documentation/perf-buildid-cache.txt
> +++ b/tools/perf/Documentation/perf-buildid-cache.txt
> @@ -48,6 +48,9 @@ OPTIONS
> --purge=::
> Purge all cached binaries including older caches which have specified
> path from the cache.
> +-P::
> +--purge-all::
> + Purge all cached binaries. This will flush out entire cache.
> -M::
> --missing=::
> List missing build ids in the cache for the specified file.
> diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
> index fd0a08661b42..d11226f76fbc 100644
> --- a/tools/perf/builtin-buildid-cache.c
> +++ b/tools/perf/builtin-buildid-cache.c
> @@ -240,6 +240,34 @@ static int build_id_cache__purge_path(const char *pathname, struct nsinfo *nsi)
> return err;
> }
>
> +static int build_id_cache__purge_all(void)
> +{
> + struct strlist *list;
> + struct str_node *pos;
> + int err;
> + char *buf;
> +
> + list = build_id_cache__list_all(false);
> + if (!list) {
> + pr_debug("Failed to get buildids: -%d\n", errno);
> + return -EINVAL;
> + }
> +
> + strlist__for_each_entry(pos, list) {
> + buf = build_id_cache__origname(pos->s);
> + err = build_id_cache__remove_s(pos->s);
> + pr_debug("Removing %s (%s): %s\n", buf, pos->s,
> + err ? "FAIL" : "Ok");
> + free(buf);
> + if (err)
> + break;
> + }
> + strlist__delete(list);
> +
> + pr_debug("Purged all: %s\n", err ? "FAIL" : "Ok");
> + return err;
> +}
err may be used uninitialized, and debian:7 complains with:
CC /tmp/build/perf/util/ctype.o
builtin-buildid-cache.c: In function 'cmd_buildid_cache':
builtin-buildid-cache.c:267:2: error: 'err' may be used uninitialized in this function [-Werror=uninitialized]
builtin-buildid-cache.c:247:6: note: 'err' was declared here
MKDIR /tmp/build/perf/util/
cc1: all warnings being treated as errors
CC /tmp/build/perf/util/db-export.o
mv: cannot stat `/tmp/build/perf/.builtin-buildid-cache.o.tmp': No such file or directory
make[3]: *** [/tmp/build/perf/builtin-buildid-cache.o] Error 1
make[3]: *** Waiting for unfinished jobs....
I'm initializing it to zero.
- Arnaldo
next prev parent reply other threads:[~2018-04-23 18:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 4:13 [PATCH v2 0/3] perf/buildid-cache: Add --list and --purge-all options Ravi Bangoria
2018-04-17 4:13 ` [PATCH v2 1/3] tools/parse-options: Add '\n' at the end of error messages Ravi Bangoria
2018-04-21 7:52 ` [tip:perf/urgent] perf tools: Add '\n' at the end of parse-options " tip-bot for Ravi Bangoria
2018-04-17 4:13 ` [PATCH v2 2/3] perf/buildid-cache: Support --list option Ravi Bangoria
2018-04-23 6:59 ` Masami Hiramatsu
2018-05-02 17:39 ` [tip:perf/core] perf buildid-cache: " tip-bot for Ravi Bangoria
2018-04-17 4:13 ` [PATCH v2 3/3] perf/buildid-cache: Support --purge-all option Ravi Bangoria
2018-04-23 7:02 ` Masami Hiramatsu
2018-05-03 8:54 ` Ravi Bangoria
2018-05-08 15:42 ` Masami Hiramatsu
2018-05-09 6:00 ` Ravi Bangoria
2018-04-23 18:59 ` Arnaldo Carvalho de Melo [this message]
2018-05-02 17:40 ` [tip:perf/core] perf buildid-cache: " tip-bot for Ravi Bangoria
2018-04-17 7:57 ` [PATCH v2 0/3] perf/buildid-cache: Add --list and --purge-all options Jiri Olsa
2018-04-17 13:58 ` Arnaldo Carvalho de Melo
2018-04-18 5:54 ` Masami Hiramatsu
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=20180423185923.GB3788@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=kjlx@templeofstupid.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=pombredanne@nexb.com \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=uneedsihyeon@gmail.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