mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 2/8] perf symbols: Move idle syms check from top to generic function
Date: Thu, 28 Nov 2013 17:36:44 +0900	[thread overview]
Message-ID: <871u20rkgz.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1384806771-2945-3-git-send-email-dsahern@gmail.com> (David Ahern's message of "Mon, 18 Nov 2013 13:32:45 -0700")

Hi David,

Just minor nits below..

On Mon, 18 Nov 2013 13:32:45 -0700, David Ahern wrote:
> Allows list of idle symbols to be leveraged by other commands,
> such as the upcoming timehist command.

[SNIP]
> +bool symbol__is_idle(struct symbol *sym)
> +{
> +	const char * const idle_symbols[] = {

Wouldn't it better making it static?  It seems to build a table
everytime otherwise.


> +		"cpu_idle",
> +		"intel_idle",
> +		"default_idle",
> +		"native_safe_halt",
> +		"enter_idle",
> +		"exit_idle",
> +		"mwait_idle",
> +		"mwait_idle_with_hints",
> +		"poll_idle",
> +		"ppc64_runlatch_off",
> +		"pseries_dedicated_idle_sleep",
> +		NULL
> +	};
> +
> +	int i;
> +
> +	if (!sym)
> +		return false;
> +
> +	for (i = 0; idle_symbols[i]; i++) {

Also we can use ARRAY_SIZE() here and let the last NULL go IMHO.

Thanks,
Namhyung


> +		if (!strcmp(idle_symbols[i], sym->name))
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  static int map__process_kallsym_symbol(void *arg, const char *name,
>  				       char type, u64 start)
>  {
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 07de8fea2f48..ad13c5d50b91 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -240,6 +240,7 @@ size_t symbol__fprintf(struct symbol *sym, FILE *fp);
>  bool symbol_type__is_a(char symbol_type, enum map_type map_type);
>  bool symbol__restricted_filename(const char *filename,
>  				 const char *restricted_filename);
> +bool symbol__is_idle(struct symbol *sym);
>  
>  int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
>  		  struct symsrc *runtime_ss, symbol_filter_t filter,

  reply	other threads:[~2013-11-28  8:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 20:32 [PATCH 0/8] perf: sched timehist command David Ahern
2013-11-18 20:32 ` [PATCH 1/8] perf tool: Skip ignored symbols while printing callchain David Ahern
2013-11-30 12:52   ` [tip:perf/core] perf evsel: " tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 2/8] perf symbols: Move idle syms check from top to generic function David Ahern
2013-11-28  8:36   ` Namhyung Kim [this message]
2013-11-30 15:58     ` David Ahern
2013-11-30 12:52   ` [tip:perf/core] " tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 3/8] perf symbol: Save vmlinux or kallsyms path loaded David Ahern
2013-11-22 18:44   ` Arnaldo Carvalho de Melo
2013-11-22 19:13     ` David Ahern
2013-11-22 19:40       ` Arnaldo Carvalho de Melo
2013-11-22 20:09         ` David Ahern
2013-11-18 20:32 ` [PATCH 4/8] perf thread: Move comm_list check into function David Ahern
2013-11-30 12:52   ` [tip:perf/core] " tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 5/8] perf tool: export setup_list David Ahern
2013-11-28  8:45   ` Namhyung Kim
2013-11-30 12:52   ` [tip:perf/core] perf tools: Export setup_list tip-bot for David Ahern
2013-11-18 20:32 ` [PATCH 6/8] perf sched: Introduce timehist command David Ahern
2013-11-28  9:50   ` Namhyung Kim
2013-11-28 16:01     ` David Ahern
2013-11-28 15:38   ` Namhyung Kim
2013-11-28 16:01     ` David Ahern
2013-11-29  0:48       ` Namhyung Kim
2013-11-29  1:58         ` David Ahern
2013-12-04  4:15           ` David Ahern
2013-11-18 20:32 ` [PATCH 7/8] perf sched timehist: Add support for context-switch event David Ahern
2013-11-18 20:32 ` [PATCH 8/8] perf sched : Add documentation for timehist options David Ahern
2013-11-28 15:42   ` 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=871u20rkgz.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®