All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Joonsoo Kim <js1304@gmail.com>,
	Minchan Kim <minchan@kernel.org>,
	Pekka Enberg <penberg@kernel.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH v3 6/6] perf kmem: Show warning when trying to run stat without record
Date: Tue, 5 May 2015 12:01:15 -0300	[thread overview]
Message-ID: <20150505150115.GS10475@kernel.org> (raw)
In-Reply-To: <1430837572-31395-1-git-send-email-namhyung@kernel.org>

Em Tue, May 05, 2015 at 11:52:52PM +0900, Namhyung Kim escreveu:
> Sometimes one can mistakenly run perf kmem stat without perf kmem
> record before or different configuration like recoding --slab and stat
> --page.  Show a warning message like below to inform user:
> 
>   # perf kmem stat --page --caller
>   No page allocation events found.  Have you run 'perf kmem record --page'?
> 
> Acked-by: Pekka Enberg <penberg@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Thanks, replacing that patch with this one.

- Arnaldo


> ---
> Update the warning message.
> 
>  tools/perf/builtin-kmem.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
> index 828b7284e547..e628bf1a0c24 100644
> --- a/tools/perf/builtin-kmem.c
> +++ b/tools/perf/builtin-kmem.c
> @@ -1882,6 +1882,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
>  	};
>  	struct perf_session *session;
>  	int ret = -1;
> +	const char errmsg[] = "No %s allocation events found.  Have you run 'perf kmem record --%s'?\n";
>  
>  	perf_config(kmem_config, NULL);
>  	argc = parse_options_subcommand(argc, argv, kmem_options,
> @@ -1908,11 +1909,21 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
>  	if (session == NULL)
>  		return -1;
>  
> +	if (kmem_slab) {
> +		if (!perf_evlist__find_tracepoint_by_name(session->evlist,
> +							  "kmem:kmalloc")) {
> +			pr_err(errmsg, "slab", "slab");
> +			return -1;
> +		}
> +	}
> +
>  	if (kmem_page) {
> -		struct perf_evsel *evsel = perf_evlist__first(session->evlist);
> +		struct perf_evsel *evsel;
>  
> -		if (evsel == NULL || evsel->tp_format == NULL) {
> -			pr_err("invalid event found.. aborting\n");
> +		evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
> +							     "kmem:mm_page_alloc");
> +		if (evsel == NULL) {
> +			pr_err(errmsg, "page", "page");
>  			return -1;
>  		}
>  
> -- 
> 2.3.7

WARNING: multiple messages have this Message-ID (diff)
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Joonsoo Kim <js1304@gmail.com>,
	Minchan Kim <minchan@kernel.org>,
	Pekka Enberg <penberg@kernel.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH v3 6/6] perf kmem: Show warning when trying to run stat without record
Date: Tue, 5 May 2015 12:01:15 -0300	[thread overview]
Message-ID: <20150505150115.GS10475@kernel.org> (raw)
In-Reply-To: <1430837572-31395-1-git-send-email-namhyung@kernel.org>

Em Tue, May 05, 2015 at 11:52:52PM +0900, Namhyung Kim escreveu:
> Sometimes one can mistakenly run perf kmem stat without perf kmem
> record before or different configuration like recoding --slab and stat
> --page.  Show a warning message like below to inform user:
> 
>   # perf kmem stat --page --caller
>   No page allocation events found.  Have you run 'perf kmem record --page'?
> 
> Acked-by: Pekka Enberg <penberg@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Thanks, replacing that patch with this one.

- Arnaldo


> ---
> Update the warning message.
> 
>  tools/perf/builtin-kmem.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
> index 828b7284e547..e628bf1a0c24 100644
> --- a/tools/perf/builtin-kmem.c
> +++ b/tools/perf/builtin-kmem.c
> @@ -1882,6 +1882,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
>  	};
>  	struct perf_session *session;
>  	int ret = -1;
> +	const char errmsg[] = "No %s allocation events found.  Have you run 'perf kmem record --%s'?\n";
>  
>  	perf_config(kmem_config, NULL);
>  	argc = parse_options_subcommand(argc, argv, kmem_options,
> @@ -1908,11 +1909,21 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
>  	if (session == NULL)
>  		return -1;
>  
> +	if (kmem_slab) {
> +		if (!perf_evlist__find_tracepoint_by_name(session->evlist,
> +							  "kmem:kmalloc")) {
> +			pr_err(errmsg, "slab", "slab");
> +			return -1;
> +		}
> +	}
> +
>  	if (kmem_page) {
> -		struct perf_evsel *evsel = perf_evlist__first(session->evlist);
> +		struct perf_evsel *evsel;
>  
> -		if (evsel == NULL || evsel->tp_format == NULL) {
> -			pr_err("invalid event found.. aborting\n");
> +		evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
> +							     "kmem:mm_page_alloc");
> +		if (evsel == NULL) {
> +			pr_err(errmsg, "page", "page");
>  			return -1;
>  		}
>  
> -- 
> 2.3.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-05-05 16:08 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  4:55 [PATCHSET 0/6] perf kmem: Implement page allocation analysis (v8) Namhyung Kim
2015-04-21  4:55 ` Namhyung Kim
2015-04-21  4:55 ` [PATCH 1/6] perf kmem: Implement stat --page --caller Namhyung Kim
2015-04-21  4:55   ` Namhyung Kim
2015-05-04 15:38   ` Arnaldo Carvalho de Melo
2015-05-04 15:38     ` Arnaldo Carvalho de Melo
2015-05-04 16:11     ` Arnaldo Carvalho de Melo
2015-05-04 16:11       ` Arnaldo Carvalho de Melo
2015-05-06  3:14   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-21  4:55 ` [PATCH 2/6] perf kmem: Support sort keys on page analysis Namhyung Kim
2015-04-21  4:55   ` Namhyung Kim
2015-05-06  3:14   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-21  4:55 ` [PATCH 3/6] perf kmem: Add --live option for current allocation stat Namhyung Kim
2015-04-21  4:55   ` Namhyung Kim
2015-05-06  3:15   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-21  4:55 ` [PATCH 4/6] perf kmem: Print gfp flags in human readable string Namhyung Kim
2015-04-21  4:55   ` Namhyung Kim
2015-05-06  3:15   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-05-11 14:35   ` [PATCH 4/6] " Arnaldo Carvalho de Melo
2015-05-11 14:35     ` Arnaldo Carvalho de Melo
2015-05-11 14:41     ` Arnaldo Carvalho de Melo
2015-05-11 14:41       ` Arnaldo Carvalho de Melo
2015-05-11 15:26       ` Namhyung Kim
2015-05-11 15:26         ` Namhyung Kim
2015-04-21  4:55 ` [PATCH 5/6] perf kmem: Add kmem.default config option Namhyung Kim
2015-04-21  4:55   ` Namhyung Kim
2015-05-06  3:15   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-21  4:55 ` [PATCH 6/6] perf kmem: Show warning when trying to run stat without record Namhyung Kim
2015-04-21  4:55   ` Namhyung Kim
2015-05-04 16:15   ` Arnaldo Carvalho de Melo
2015-05-04 16:15     ` Arnaldo Carvalho de Melo
2015-05-05  0:58     ` [PATCH v2] " Namhyung Kim
2015-05-05  0:58       ` Namhyung Kim
2015-05-05 14:07       ` Arnaldo Carvalho de Melo
2015-05-05 14:07         ` Arnaldo Carvalho de Melo
2015-05-05 14:16         ` Pekka Enberg
2015-05-05 14:16           ` Pekka Enberg
2015-05-05 14:52           ` [PATCH v3 6/6] " Namhyung Kim
2015-05-05 14:52             ` Namhyung Kim
2015-05-05 15:01             ` Arnaldo Carvalho de Melo [this message]
2015-05-05 15:01               ` Arnaldo Carvalho de Melo
2015-05-06  3:19             ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-05-02 14:55 ` [PATCHSET 0/6] perf kmem: Implement page allocation analysis (v8) Namhyung Kim
2015-05-02 14:55   ` Namhyung Kim

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=20150505150115.GS10475@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=penberg@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.