public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Mike Galbraith <efault@gmx.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2 tip] perf: report should only load text symbols from kallsyms
Date: Wed, 27 May 2009 08:10:01 +0200	[thread overview]
Message-ID: <20090527061001.GA27060@elte.hu> (raw)
In-Reply-To: <20090526222155.GJ4424@ghostprotocols.net>


* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:

> >From 7508bc84d541ac245be633803d393244b6860af6 Mon Sep 17 00:00:00 2001
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date: Tue, 26 May 2009 19:14:47 -0300
> Subject: [PATCH] perf: report should only load text symbols from kallsyms
> 
> Just like we do for userspace when reading the symtab, reducing the
> number of entries we insert on the symbols rbtree.
> 
> Before:
> 
> [acme@emilia ~]$ rm -f perf_report.perf ; perf record -o perf_report.perf perf stat perf report > /dev/null
> 
>  Performance counter stats for 'perf':
> 
>      218.138382  task clock ticks     (msecs)
>               4  context switches     (events)
>               8  CPU migrations       (events)
>            2136  pagefaults           (events)
>        32746212  CPU cycles           (events)  (scaled from 67.04%)
>        11961102  instructions         (events)  (scaled from 66.19%)
>           49841  cache references     (events)  (scaled from 21.96%)
>           13777  cache misses         (events)  (scaled from 21.98%)
> 
>  Wall-clock time elapsed:   218.702477 msecs
> 
> [acme@emilia ~]$ perf report -i perf_report.perf | head
> 11.06          perf [.] 0x00000000000057cb /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
>  9.15          perf [.] 0x00000000000056a0 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__insert_symbol
>  8.72          perf [k] 0xffffffff8101b1d2 intel_pmu_enable_all
>  8.51          perf [.] 0x0000000000006672 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: thread__symbol_incnew
>  3.83          perf [k] 0xffffffff811cfc5a vsnprintf
>  3.40          perf [.] 0x0000000000005e33 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex
>  3.40          perf [.] 0x0000000000005ec7 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex2long
>  3.19          perf [k] 0xffffffff811ce1c1 number
>  2.77          perf [.] 0x0000000000006869 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: threads__findnew
>  2.77          perf [.] 0x000000000000fde3 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: rb_insert_color
> [acme@emilia ~]$
> 
> After:
> 
> acme@emilia ~]$ rm -f perf_report.perf ; perf record -o perf_report.perf perf stat perf report > /dev/null
> 
>  Performance counter stats for 'perf':
> 
>      190.228511  task clock ticks     (msecs)
>               4  context switches     (events)
>               7  CPU migrations       (events)
>            1625  pagefaults           (events)
>        29578745  CPU cycles           (events)  (scaled from 66.92%)
>        10516914  instructions         (events)  (scaled from 66.47%)
>           44015  cache references     (events)  (scaled from 22.04%)
>            8248  cache misses         (events)  (scaled from 22.07%)
> 
>  Wall-clock time elapsed:   190.816096 msecs

nice!

> [acme@emilia ~]$ perf report -i perf_report.perf | head
> 15.99          perf [.] 0x00000000000057a9 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__find_symbol
> 10.87          perf [.] 0x000000000000674d /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: thread__symbol_incnew
>  8.74          perf [k] 0xffffffff8101b1d2 intel_pmu_enable_all
>  5.54          perf [.] 0x0000000000005e42 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex
>  4.48          perf [.] 0x0000000000005ebe /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: hex2long
>  4.48          perf [k] 0xffffffff811cfba0 vsnprintf
>  3.84          perf [.] 0x00000000000056b4 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: dso__insert_symbol
>  3.62          perf [.] 0x00000000000068d0 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: threads__findnew
>  3.20          perf [k] 0xffffffff811ce0b3 number
>  2.56          perf [.] 0x0000000000006d78 /home/acme/git/linux-2.6-tip/Documentation/perf_counter/perf: __cmd_report
> [acme@emilia ~]$
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  Documentation/perf_counter/builtin-report.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
> index c517483..a55f15d 100644
> --- a/Documentation/perf_counter/builtin-report.c
> +++ b/Documentation/perf_counter/builtin-report.c
> @@ -3,6 +3,7 @@
>  #include <libelf.h>
>  #include <gelf.h>
>  #include <elf.h>
> +#include <ctype.h>
>  
>  #include "util/list.h"
>  #include "util/rbtree.h"
> @@ -408,13 +409,20 @@ static int load_kallsyms(void)
>  
>  		int len = hex2long(line, &start);
>  		
> -		len += 3; /* ' t ' */
> -		if (len >= line_len)
> +		len++;
> +		if (len + 2 >= line_len)
> +			continue;
> +
> +		char symbol_type = line[len];
> +		/*
> +		 * We're interested only in code ('T'ext)
> +		 */
> +		if (toupper(symbol_type) != 'T')
>  			continue;

We would also include ' W ' symbols, right?

	Ingo

  reply	other threads:[~2009-05-27  6:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 22:21 [PATCH 2/2 tip] perf: report should only load text symbols from kallsyms Arnaldo Carvalho de Melo
2009-05-27  6:10 ` Ingo Molnar [this message]
2009-05-27  7:16 ` [tip:perfcounters/core] perf report: Only " tip-bot for Arnaldo Carvalho de Melo
2009-05-27  7:16 ` [tip:perfcounters/core] perf report: Only load text symbols from kallsyms, fix tip-bot for Ingo Molnar
2009-05-27  7:16 ` [tip:perfcounters/core] perf_counter tools: Introduce stricter C code checking tip-bot for Ingo Molnar
2009-05-28  3:56   ` Paul Mackerras
2009-05-28  8:35     ` 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=20090527061001.GA27060@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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