linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages
@ 2013-09-18 13:56 Ricardo Ribalda Delgado
  2013-09-19 17:03 ` Ricardo Ribalda Delgado
  2013-10-15  5:23 ` [tip:perf/core] perf symbols: Support for Openembedded/ Yocto " tip-bot for Ricardo Ribalda Delgado
  0 siblings, 2 replies; 5+ messages in thread
From: Ricardo Ribalda Delgado @ 2013-09-18 13:56 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ricardo Ribalda Delgado, Paul Mackerras, Ingo Molnar,
	Namhyung Kim, Waiman Long, Stephane Eranian, Jiri Olsa,
	David Ahern, LKML

On OpenEmbedded the symbol files are located under a .debug folder on
the same folder as the binary file.

This patch adds support for such files.

Without this patch on perf top you can see:

no symbols found in /usr/lib/gstreamer-1.0/libtheoraenc.so.1.1.2, maybe install
a debug package?

84.56%  libtheoraenc.so.1.1.2       [.] 0x000000000000b346

With this patch symbols are shown:

19.06%  libtheoraenc.so.1.1.2       [.] oc_int_frag_satd_thresh_mmxext
9.76%   libtheoraenc.so.1.1.2       [.] oc_analyze_mb_mode_luma
5.58%   libtheoraenc.so.1.1.2       [.] oc_qii_state_advance
4.84%   libtheoraenc.so.1.1.2       [.] oc_enc_tokenize_ac
...

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---

v2: Changes proposed by Ingo Molnar

-Improve changeset
-Improve multi-snprintf readability
-Code Style

v3: Changes proposed by Ingo Molnar, Arnaldo Carvalho de Melo and Peter Zijlstra

-Code Style
-Use scnprintf


 tools/perf/util/dso.c    | 49 +++++++++++++++++++++++++++++++++++-------------
 tools/perf/util/dso.h    |  1 +
 tools/perf/util/symbol.c |  1 +
 3 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index e3c1ff8..6bfc8aa 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -7,19 +7,20 @@
 char dso__symtab_origin(const struct dso *dso)
 {
 	static const char origin[] = {
-		[DSO_BINARY_TYPE__KALLSYMS]		= 'k',
-		[DSO_BINARY_TYPE__VMLINUX]		= 'v',
-		[DSO_BINARY_TYPE__JAVA_JIT]		= 'j',
-		[DSO_BINARY_TYPE__DEBUGLINK]		= 'l',
-		[DSO_BINARY_TYPE__BUILD_ID_CACHE]	= 'B',
-		[DSO_BINARY_TYPE__FEDORA_DEBUGINFO]	= 'f',
-		[DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]	= 'u',
-		[DSO_BINARY_TYPE__BUILDID_DEBUGINFO]	= 'b',
-		[DSO_BINARY_TYPE__SYSTEM_PATH_DSO]	= 'd',
-		[DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]	= 'K',
-		[DSO_BINARY_TYPE__GUEST_KALLSYMS]	= 'g',
-		[DSO_BINARY_TYPE__GUEST_KMODULE]	= 'G',
-		[DSO_BINARY_TYPE__GUEST_VMLINUX]	= 'V',
+		[DSO_BINARY_TYPE__KALLSYMS]			= 'k',
+		[DSO_BINARY_TYPE__VMLINUX]			= 'v',
+		[DSO_BINARY_TYPE__JAVA_JIT]			= 'j',
+		[DSO_BINARY_TYPE__DEBUGLINK]			= 'l',
+		[DSO_BINARY_TYPE__BUILD_ID_CACHE]		= 'B',
+		[DSO_BINARY_TYPE__FEDORA_DEBUGINFO]		= 'f',
+		[DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]		= 'u',
+		[DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO]	= 'o',
+		[DSO_BINARY_TYPE__BUILDID_DEBUGINFO]		= 'b',
+		[DSO_BINARY_TYPE__SYSTEM_PATH_DSO]		= 'd',
+		[DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]		= 'K',
+		[DSO_BINARY_TYPE__GUEST_KALLSYMS]		= 'g',
+		[DSO_BINARY_TYPE__GUEST_KMODULE]		= 'G',
+		[DSO_BINARY_TYPE__GUEST_VMLINUX]		= 'V',
 	};
 
 	if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND)
@@ -64,6 +65,28 @@ int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
 			 symbol_conf.symfs, dso->long_name);
 		break;
 
+	case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
+	{
+		char *last_slash;
+		size_t len;
+		size_t dir_size;
+
+		last_slash = dso->long_name + dso->long_name_len;
+		while (last_slash != dso->long_name && *last_slash != '/')
+			last_slash--;
+
+		len = scnprintf(file, size, "%s", symbol_conf.symfs);
+		dir_size = last_slash - dso->long_name + 2;
+		if (dir_size > (size - len)) {
+			ret = -1;
+			break;
+		}
+		len += scnprintf(file + len, dir_size, "%s",  dso->long_name);
+		len += scnprintf(file + len , size - len, ".debug%s",
+								last_slash);
+		break;
+	}
+
 	case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
 		if (!dso->has_build_id) {
 			ret = -1;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index b793053..dbd9241 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -23,6 +23,7 @@ enum dso_binary_type {
 	DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
 	DSO_BINARY_TYPE__KCORE,
 	DSO_BINARY_TYPE__GUEST_KCORE,
+	DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
 	DSO_BINARY_TYPE__NOT_FOUND,
 };
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 7eb0362..cd1dcc4 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -51,6 +51,7 @@ static enum dso_binary_type binary_type_symtab[] = {
 	DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
 	DSO_BINARY_TYPE__GUEST_KMODULE,
 	DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
+	DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
 	DSO_BINARY_TYPE__NOT_FOUND,
 };
 
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages
  2013-09-18 13:56 [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages Ricardo Ribalda Delgado
@ 2013-09-19 17:03 ` Ricardo Ribalda Delgado
  2013-09-19 18:24   ` Arnaldo Carvalho de Melo
  2013-09-20  5:45   ` Ingo Molnar
  2013-10-15  5:23 ` [tip:perf/core] perf symbols: Support for Openembedded/ Yocto " tip-bot for Ricardo Ribalda Delgado
  1 sibling, 2 replies; 5+ messages in thread
From: Ricardo Ribalda Delgado @ 2013-09-19 17:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ricardo Ribalda Delgado, Paul Mackerras, Ingo Molnar,
	Namhyung Kim, Waiman Long, Stephane Eranian, Jiri Olsa,
	David Ahern, LKML

Anything else to fix on this patch?

On Wed, Sep 18, 2013 at 3:56 PM, Ricardo Ribalda Delgado
<ricardo.ribalda@gmail.com> wrote:
> On OpenEmbedded the symbol files are located under a .debug folder on
> the same folder as the binary file.
>
> This patch adds support for such files.
>
> Without this patch on perf top you can see:
>
> no symbols found in /usr/lib/gstreamer-1.0/libtheoraenc.so.1.1.2, maybe install
> a debug package?
>
> 84.56%  libtheoraenc.so.1.1.2       [.] 0x000000000000b346
>
> With this patch symbols are shown:
>
> 19.06%  libtheoraenc.so.1.1.2       [.] oc_int_frag_satd_thresh_mmxext
> 9.76%   libtheoraenc.so.1.1.2       [.] oc_analyze_mb_mode_luma
> 5.58%   libtheoraenc.so.1.1.2       [.] oc_qii_state_advance
> 4.84%   libtheoraenc.so.1.1.2       [.] oc_enc_tokenize_ac
> ...
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
>
> v2: Changes proposed by Ingo Molnar
>
> -Improve changeset
> -Improve multi-snprintf readability
> -Code Style
>
> v3: Changes proposed by Ingo Molnar, Arnaldo Carvalho de Melo and Peter Zijlstra
>
> -Code Style
> -Use scnprintf
>
>
>  tools/perf/util/dso.c    | 49 +++++++++++++++++++++++++++++++++++-------------
>  tools/perf/util/dso.h    |  1 +
>  tools/perf/util/symbol.c |  1 +
>  3 files changed, 38 insertions(+), 13 deletions(-)
>
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index e3c1ff8..6bfc8aa 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -7,19 +7,20 @@
>  char dso__symtab_origin(const struct dso *dso)
>  {
>         static const char origin[] = {
> -               [DSO_BINARY_TYPE__KALLSYMS]             = 'k',
> -               [DSO_BINARY_TYPE__VMLINUX]              = 'v',
> -               [DSO_BINARY_TYPE__JAVA_JIT]             = 'j',
> -               [DSO_BINARY_TYPE__DEBUGLINK]            = 'l',
> -               [DSO_BINARY_TYPE__BUILD_ID_CACHE]       = 'B',
> -               [DSO_BINARY_TYPE__FEDORA_DEBUGINFO]     = 'f',
> -               [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]     = 'u',
> -               [DSO_BINARY_TYPE__BUILDID_DEBUGINFO]    = 'b',
> -               [DSO_BINARY_TYPE__SYSTEM_PATH_DSO]      = 'd',
> -               [DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]  = 'K',
> -               [DSO_BINARY_TYPE__GUEST_KALLSYMS]       = 'g',
> -               [DSO_BINARY_TYPE__GUEST_KMODULE]        = 'G',
> -               [DSO_BINARY_TYPE__GUEST_VMLINUX]        = 'V',
> +               [DSO_BINARY_TYPE__KALLSYMS]                     = 'k',
> +               [DSO_BINARY_TYPE__VMLINUX]                      = 'v',
> +               [DSO_BINARY_TYPE__JAVA_JIT]                     = 'j',
> +               [DSO_BINARY_TYPE__DEBUGLINK]                    = 'l',
> +               [DSO_BINARY_TYPE__BUILD_ID_CACHE]               = 'B',
> +               [DSO_BINARY_TYPE__FEDORA_DEBUGINFO]             = 'f',
> +               [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]             = 'u',
> +               [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO]       = 'o',
> +               [DSO_BINARY_TYPE__BUILDID_DEBUGINFO]            = 'b',
> +               [DSO_BINARY_TYPE__SYSTEM_PATH_DSO]              = 'd',
> +               [DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]          = 'K',
> +               [DSO_BINARY_TYPE__GUEST_KALLSYMS]               = 'g',
> +               [DSO_BINARY_TYPE__GUEST_KMODULE]                = 'G',
> +               [DSO_BINARY_TYPE__GUEST_VMLINUX]                = 'V',
>         };
>
>         if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND)
> @@ -64,6 +65,28 @@ int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
>                          symbol_conf.symfs, dso->long_name);
>                 break;
>
> +       case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
> +       {
> +               char *last_slash;
> +               size_t len;
> +               size_t dir_size;
> +
> +               last_slash = dso->long_name + dso->long_name_len;
> +               while (last_slash != dso->long_name && *last_slash != '/')
> +                       last_slash--;
> +
> +               len = scnprintf(file, size, "%s", symbol_conf.symfs);
> +               dir_size = last_slash - dso->long_name + 2;
> +               if (dir_size > (size - len)) {
> +                       ret = -1;
> +                       break;
> +               }
> +               len += scnprintf(file + len, dir_size, "%s",  dso->long_name);
> +               len += scnprintf(file + len , size - len, ".debug%s",
> +                                                               last_slash);
> +               break;
> +       }
> +
>         case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
>                 if (!dso->has_build_id) {
>                         ret = -1;
> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> index b793053..dbd9241 100644
> --- a/tools/perf/util/dso.h
> +++ b/tools/perf/util/dso.h
> @@ -23,6 +23,7 @@ enum dso_binary_type {
>         DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
>         DSO_BINARY_TYPE__KCORE,
>         DSO_BINARY_TYPE__GUEST_KCORE,
> +       DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
>         DSO_BINARY_TYPE__NOT_FOUND,
>  };
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 7eb0362..cd1dcc4 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -51,6 +51,7 @@ static enum dso_binary_type binary_type_symtab[] = {
>         DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
>         DSO_BINARY_TYPE__GUEST_KMODULE,
>         DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
> +       DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
>         DSO_BINARY_TYPE__NOT_FOUND,
>  };
>
> --
> 1.8.4.rc3
>



-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages
  2013-09-19 17:03 ` Ricardo Ribalda Delgado
@ 2013-09-19 18:24   ` Arnaldo Carvalho de Melo
  2013-09-20  5:45   ` Ingo Molnar
  1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-09-19 18:24 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim,
	Waiman Long, Stephane Eranian, Jiri Olsa, David Ahern, LKML

Em Thu, Sep 19, 2013 at 07:03:43PM +0200, Ricardo Ribalda Delgado escreveu:
> Anything else to fix on this patch?

Not from a quick read, thanks for addressing the comments, I'll stash it
in my perf/core branch.

- Arnaldo
 
> On Wed, Sep 18, 2013 at 3:56 PM, Ricardo Ribalda Delgado
> <ricardo.ribalda@gmail.com> wrote:
> > On OpenEmbedded the symbol files are located under a .debug folder on
> > the same folder as the binary file.
> >
> > This patch adds support for such files.
> >
> > Without this patch on perf top you can see:
> >
> > no symbols found in /usr/lib/gstreamer-1.0/libtheoraenc.so.1.1.2, maybe install
> > a debug package?
> >
> > 84.56%  libtheoraenc.so.1.1.2       [.] 0x000000000000b346
> >
> > With this patch symbols are shown:
> >
> > 19.06%  libtheoraenc.so.1.1.2       [.] oc_int_frag_satd_thresh_mmxext
> > 9.76%   libtheoraenc.so.1.1.2       [.] oc_analyze_mb_mode_luma
> > 5.58%   libtheoraenc.so.1.1.2       [.] oc_qii_state_advance
> > 4.84%   libtheoraenc.so.1.1.2       [.] oc_enc_tokenize_ac
> > ...
> >
> > Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> > ---
> >
> > v2: Changes proposed by Ingo Molnar
> >
> > -Improve changeset
> > -Improve multi-snprintf readability
> > -Code Style
> >
> > v3: Changes proposed by Ingo Molnar, Arnaldo Carvalho de Melo and Peter Zijlstra
> >
> > -Code Style
> > -Use scnprintf
> >
> >
> >  tools/perf/util/dso.c    | 49 +++++++++++++++++++++++++++++++++++-------------
> >  tools/perf/util/dso.h    |  1 +
> >  tools/perf/util/symbol.c |  1 +
> >  3 files changed, 38 insertions(+), 13 deletions(-)
> >
> > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> > index e3c1ff8..6bfc8aa 100644
> > --- a/tools/perf/util/dso.c
> > +++ b/tools/perf/util/dso.c
> > @@ -7,19 +7,20 @@
> >  char dso__symtab_origin(const struct dso *dso)
> >  {
> >         static const char origin[] = {
> > -               [DSO_BINARY_TYPE__KALLSYMS]             = 'k',
> > -               [DSO_BINARY_TYPE__VMLINUX]              = 'v',
> > -               [DSO_BINARY_TYPE__JAVA_JIT]             = 'j',
> > -               [DSO_BINARY_TYPE__DEBUGLINK]            = 'l',
> > -               [DSO_BINARY_TYPE__BUILD_ID_CACHE]       = 'B',
> > -               [DSO_BINARY_TYPE__FEDORA_DEBUGINFO]     = 'f',
> > -               [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]     = 'u',
> > -               [DSO_BINARY_TYPE__BUILDID_DEBUGINFO]    = 'b',
> > -               [DSO_BINARY_TYPE__SYSTEM_PATH_DSO]      = 'd',
> > -               [DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]  = 'K',
> > -               [DSO_BINARY_TYPE__GUEST_KALLSYMS]       = 'g',
> > -               [DSO_BINARY_TYPE__GUEST_KMODULE]        = 'G',
> > -               [DSO_BINARY_TYPE__GUEST_VMLINUX]        = 'V',
> > +               [DSO_BINARY_TYPE__KALLSYMS]                     = 'k',
> > +               [DSO_BINARY_TYPE__VMLINUX]                      = 'v',
> > +               [DSO_BINARY_TYPE__JAVA_JIT]                     = 'j',
> > +               [DSO_BINARY_TYPE__DEBUGLINK]                    = 'l',
> > +               [DSO_BINARY_TYPE__BUILD_ID_CACHE]               = 'B',
> > +               [DSO_BINARY_TYPE__FEDORA_DEBUGINFO]             = 'f',
> > +               [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]             = 'u',
> > +               [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO]       = 'o',
> > +               [DSO_BINARY_TYPE__BUILDID_DEBUGINFO]            = 'b',
> > +               [DSO_BINARY_TYPE__SYSTEM_PATH_DSO]              = 'd',
> > +               [DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]          = 'K',
> > +               [DSO_BINARY_TYPE__GUEST_KALLSYMS]               = 'g',
> > +               [DSO_BINARY_TYPE__GUEST_KMODULE]                = 'G',
> > +               [DSO_BINARY_TYPE__GUEST_VMLINUX]                = 'V',
> >         };
> >
> >         if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND)
> > @@ -64,6 +65,28 @@ int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
> >                          symbol_conf.symfs, dso->long_name);
> >                 break;
> >
> > +       case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
> > +       {
> > +               char *last_slash;
> > +               size_t len;
> > +               size_t dir_size;
> > +
> > +               last_slash = dso->long_name + dso->long_name_len;
> > +               while (last_slash != dso->long_name && *last_slash != '/')
> > +                       last_slash--;
> > +
> > +               len = scnprintf(file, size, "%s", symbol_conf.symfs);
> > +               dir_size = last_slash - dso->long_name + 2;
> > +               if (dir_size > (size - len)) {
> > +                       ret = -1;
> > +                       break;
> > +               }
> > +               len += scnprintf(file + len, dir_size, "%s",  dso->long_name);
> > +               len += scnprintf(file + len , size - len, ".debug%s",
> > +                                                               last_slash);
> > +               break;
> > +       }
> > +
> >         case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
> >                 if (!dso->has_build_id) {
> >                         ret = -1;
> > diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> > index b793053..dbd9241 100644
> > --- a/tools/perf/util/dso.h
> > +++ b/tools/perf/util/dso.h
> > @@ -23,6 +23,7 @@ enum dso_binary_type {
> >         DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
> >         DSO_BINARY_TYPE__KCORE,
> >         DSO_BINARY_TYPE__GUEST_KCORE,
> > +       DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
> >         DSO_BINARY_TYPE__NOT_FOUND,
> >  };
> >
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > index 7eb0362..cd1dcc4 100644
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -51,6 +51,7 @@ static enum dso_binary_type binary_type_symtab[] = {
> >         DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
> >         DSO_BINARY_TYPE__GUEST_KMODULE,
> >         DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
> > +       DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
> >         DSO_BINARY_TYPE__NOT_FOUND,
> >  };
> >
> > --
> > 1.8.4.rc3
> >
> 
> 
> 
> -- 
> Ricardo Ribalda

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages
  2013-09-19 17:03 ` Ricardo Ribalda Delgado
  2013-09-19 18:24   ` Arnaldo Carvalho de Melo
@ 2013-09-20  5:45   ` Ingo Molnar
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2013-09-20  5:45 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
	Ingo Molnar, Namhyung Kim, Waiman Long, Stephane Eranian,
	Jiri Olsa, David Ahern, LKML


* Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> wrote:

> Anything else to fix on this patch?

Looks good to me, thanks!

Acked-by: Ingo Molnar <mingo@kernel.org>

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf symbols: Support for Openembedded/ Yocto -dbg packages
  2013-09-18 13:56 [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages Ricardo Ribalda Delgado
  2013-09-19 17:03 ` Ricardo Ribalda Delgado
@ 2013-10-15  5:23 ` tip-bot for Ricardo Ribalda Delgado
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Ricardo Ribalda Delgado @ 2013-10-15  5:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, paulus, mingo, hpa, mingo, peterz,
	namhyung, jolsa, Waiman.Long, ricardo.ribalda, dsahern, tglx

Commit-ID:  9cd00941f8c274e6ca03ed238d96ddb0be474b86
Gitweb:     http://git.kernel.org/tip/9cd00941f8c274e6ca03ed238d96ddb0be474b86
Author:     Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
AuthorDate: Wed, 18 Sep 2013 15:56:14 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 9 Oct 2013 11:12:41 -0300

perf symbols: Support for Openembedded/Yocto -dbg packages

On OpenEmbedded the symbol files are located under a .debug folder on
the same folder as the binary file.

This patch adds support for such files.

Without this patch on perf top you can see:

no symbols found in /usr/lib/gstreamer-1.0/libtheoraenc.so.1.1.2, maybe
install a debug package?

84.56%  libtheoraenc.so.1.1.2       [.] 0x000000000000b346

With this patch symbols are shown:

19.06%  libtheoraenc.so.1.1.2       [.] oc_int_frag_satd_thresh_mmxext
9.76%   libtheoraenc.so.1.1.2       [.] oc_analyze_mb_mode_luma
5.58%   libtheoraenc.so.1.1.2       [.] oc_qii_state_advance
4.84%   libtheoraenc.so.1.1.2       [.] oc_enc_tokenize_ac
...

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Waiman Long <Waiman.Long@hp.com>
Link: http://lkml.kernel.org/r/1379512574-25912-1-git-send-email-ricardo.ribalda@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/dso.c    | 49 +++++++++++++++++++++++++++++++++++-------------
 tools/perf/util/dso.h    |  1 +
 tools/perf/util/symbol.c |  1 +
 3 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index e3c1ff8..6bfc8aa 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -7,19 +7,20 @@
 char dso__symtab_origin(const struct dso *dso)
 {
 	static const char origin[] = {
-		[DSO_BINARY_TYPE__KALLSYMS]		= 'k',
-		[DSO_BINARY_TYPE__VMLINUX]		= 'v',
-		[DSO_BINARY_TYPE__JAVA_JIT]		= 'j',
-		[DSO_BINARY_TYPE__DEBUGLINK]		= 'l',
-		[DSO_BINARY_TYPE__BUILD_ID_CACHE]	= 'B',
-		[DSO_BINARY_TYPE__FEDORA_DEBUGINFO]	= 'f',
-		[DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]	= 'u',
-		[DSO_BINARY_TYPE__BUILDID_DEBUGINFO]	= 'b',
-		[DSO_BINARY_TYPE__SYSTEM_PATH_DSO]	= 'd',
-		[DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]	= 'K',
-		[DSO_BINARY_TYPE__GUEST_KALLSYMS]	= 'g',
-		[DSO_BINARY_TYPE__GUEST_KMODULE]	= 'G',
-		[DSO_BINARY_TYPE__GUEST_VMLINUX]	= 'V',
+		[DSO_BINARY_TYPE__KALLSYMS]			= 'k',
+		[DSO_BINARY_TYPE__VMLINUX]			= 'v',
+		[DSO_BINARY_TYPE__JAVA_JIT]			= 'j',
+		[DSO_BINARY_TYPE__DEBUGLINK]			= 'l',
+		[DSO_BINARY_TYPE__BUILD_ID_CACHE]		= 'B',
+		[DSO_BINARY_TYPE__FEDORA_DEBUGINFO]		= 'f',
+		[DSO_BINARY_TYPE__UBUNTU_DEBUGINFO]		= 'u',
+		[DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO]	= 'o',
+		[DSO_BINARY_TYPE__BUILDID_DEBUGINFO]		= 'b',
+		[DSO_BINARY_TYPE__SYSTEM_PATH_DSO]		= 'd',
+		[DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]		= 'K',
+		[DSO_BINARY_TYPE__GUEST_KALLSYMS]		= 'g',
+		[DSO_BINARY_TYPE__GUEST_KMODULE]		= 'G',
+		[DSO_BINARY_TYPE__GUEST_VMLINUX]		= 'V',
 	};
 
 	if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND)
@@ -64,6 +65,28 @@ int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
 			 symbol_conf.symfs, dso->long_name);
 		break;
 
+	case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
+	{
+		char *last_slash;
+		size_t len;
+		size_t dir_size;
+
+		last_slash = dso->long_name + dso->long_name_len;
+		while (last_slash != dso->long_name && *last_slash != '/')
+			last_slash--;
+
+		len = scnprintf(file, size, "%s", symbol_conf.symfs);
+		dir_size = last_slash - dso->long_name + 2;
+		if (dir_size > (size - len)) {
+			ret = -1;
+			break;
+		}
+		len += scnprintf(file + len, dir_size, "%s",  dso->long_name);
+		len += scnprintf(file + len , size - len, ".debug%s",
+								last_slash);
+		break;
+	}
+
 	case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
 		if (!dso->has_build_id) {
 			ret = -1;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index b793053..dbd9241 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -23,6 +23,7 @@ enum dso_binary_type {
 	DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
 	DSO_BINARY_TYPE__KCORE,
 	DSO_BINARY_TYPE__GUEST_KCORE,
+	DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
 	DSO_BINARY_TYPE__NOT_FOUND,
 };
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 7eb0362..cd1dcc4 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -51,6 +51,7 @@ static enum dso_binary_type binary_type_symtab[] = {
 	DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
 	DSO_BINARY_TYPE__GUEST_KMODULE,
 	DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
+	DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
 	DSO_BINARY_TYPE__NOT_FOUND,
 };
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-15  5:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-18 13:56 [PATCHv3] perf: Support for Openembedded/Yocto -dbg packages Ricardo Ribalda Delgado
2013-09-19 17:03 ` Ricardo Ribalda Delgado
2013-09-19 18:24   ` Arnaldo Carvalho de Melo
2013-09-20  5:45   ` Ingo Molnar
2013-10-15  5:23 ` [tip:perf/core] perf symbols: Support for Openembedded/ Yocto " tip-bot for Ricardo Ribalda Delgado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).