2009-06-30 23:18:36

by Anton Blanchard

[permalink] [raw]
Subject: [patch 3/8] perf top: Move skip symbols to an array

Move the list of symbols we skip into an array, making it easier to add new
ones.

Signed-off-by: Anton Blanchard <[email protected]>
---

Index: linux-2.6-tip/tools/perf/builtin-top.c
===================================================================
--- linux-2.6-tip.orig/tools/perf/builtin-top.c 2009-07-01 08:21:24.000000000 +1000
+++ linux-2.6-tip/tools/perf/builtin-top.c 2009-07-01 08:21:31.000000000 +1000
@@ -286,11 +286,22 @@
return NULL;
}

+/* Tag samples to be skipped. */
+char *skip_symbols[] = {
+ "default_idle",
+ "cpu_idle",
+ "enter_idle",
+ "exit_idle",
+ "mwait_idle",
+ NULL
+};
+
static int symbol_filter(struct dso *self, struct symbol *sym)
{
static int filter_match;
struct sym_entry *syme;
const char *name = sym->name;
+ int i;

if (!strcmp(name, "_text") ||
!strcmp(name, "_etext") ||
@@ -302,13 +313,12 @@
return 1;

syme = dso__sym_priv(self, sym);
- /* Tag samples to be skipped. */
- if (!strcmp("default_idle", name) ||
- !strcmp("cpu_idle", name) ||
- !strcmp("enter_idle", name) ||
- !strcmp("exit_idle", name) ||
- !strcmp("mwait_idle", name))
- syme->skip = 1;
+ for (i = 0; skip_symbols[i]; i++) {
+ if (!strcmp(skip_symbols[i], name)) {
+ syme->skip = 1;
+ break;
+ }
+ }

if (filter_match == 1) {
filter_end = sym->start;

--


2009-06-30 23:29:05

by Anton Blanchard

[permalink] [raw]
Subject: [tip:perfcounters/urgent] perf top: Move skip symbols to an array

Commit-ID: 2ab52083ffc057014e502cf3473adc41436922fa
Gitweb: http://git.kernel.org/tip/2ab52083ffc057014e502cf3473adc41436922fa
Author: Anton Blanchard <[email protected]>
AuthorDate: Wed, 1 Jul 2009 09:00:46 +1000
Committer: Ingo Molnar <[email protected]>
CommitDate: Wed, 1 Jul 2009 01:25:19 +0200

perf top: Move skip symbols to an array

Move the list of symbols we skip into an array, making it
easier to add new ones.

Signed-off-by: Anton Blanchard <[email protected]>
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>


---
tools/perf/builtin-top.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 5c29655..731ec6d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -286,11 +286,22 @@ static void *display_thread(void *arg)
return NULL;
}

+/* Tag samples to be skipped. */
+char *skip_symbols[] = {
+ "default_idle",
+ "cpu_idle",
+ "enter_idle",
+ "exit_idle",
+ "mwait_idle",
+ NULL
+};
+
static int symbol_filter(struct dso *self, struct symbol *sym)
{
static int filter_match;
struct sym_entry *syme;
const char *name = sym->name;
+ int i;

if (!strcmp(name, "_text") ||
!strcmp(name, "_etext") ||
@@ -302,13 +313,12 @@ static int symbol_filter(struct dso *self, struct symbol *sym)
return 1;

syme = dso__sym_priv(self, sym);
- /* Tag samples to be skipped. */
- if (!strcmp("default_idle", name) ||
- !strcmp("cpu_idle", name) ||
- !strcmp("enter_idle", name) ||
- !strcmp("exit_idle", name) ||
- !strcmp("mwait_idle", name))
- syme->skip = 1;
+ for (i = 0; skip_symbols[i]; i++) {
+ if (!strcmp(skip_symbols[i], name)) {
+ syme->skip = 1;
+ break;
+ }
+ }

if (filter_match == 1) {
filter_end = sym->start;

2009-07-01 04:32:09

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [patch 3/8] perf top: Move skip symbols to an array

HI Anton,

On Wed, 01 Jul 2009 09:00:46 +1000 Anton Blanchard <[email protected]> wrote:
>
> +/* Tag samples to be skipped. */
> +char *skip_symbols[] = {

"static const" ?

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (275.00 B)
(No filename) (197.00 B)
Download all attachments

2009-07-01 10:51:21

by Ingo Molnar

[permalink] [raw]
Subject: Re: [patch 3/8] perf top: Move skip symbols to an array


* Stephen Rothwell <[email protected]> wrote:

> HI Anton,
>
> On Wed, 01 Jul 2009 09:00:46 +1000 Anton Blanchard <[email protected]> wrote:
> >
> > +/* Tag samples to be skipped. */
> > +char *skip_symbols[] = {
>
> "static const" ?

I fixed this. Too bad there's no GCC warning for that. (Sparse
catches is but it is not enabled yet for perf.)

Ingo