From: Ingo Molnar <mingo@kernel.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Namhyung Kim <namhyung@kernel.org>,
Waiman Long <Waiman.Long@hp.com>,
Stephane Eranian <eranian@google.com>,
Jiri Olsa <jolsa@redhat.com>, David Ahern <dsahern@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: Support for Openembedded/Yocto -dbg packages
Date: Wed, 18 Sep 2013 11:24:44 +0200 [thread overview]
Message-ID: <20130918092444.GA2778@gmail.com> (raw)
In-Reply-To: <1379493790-9554-1-git-send-email-ricardo.ribalda@gmail.com>
* 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.
It would be nice to cite before/after perf report output, to see how this
improved things and to see the output format you picked.
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> tools/perf/util/dso.c | 16 ++++++++++++++++
> tools/perf/util/dso.h | 1 +
> tools/perf/util/symbol.c | 1 +
> 3 files changed, 18 insertions(+)
>
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index c4374f0..bab18b7 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -14,6 +14,7 @@ char dso__symtab_origin(const struct dso *dso)
> [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',
Stylistic nit: if a new entry breaks vertical alignment then re-align the
other entries as well so that it still looks nice after your change ...
> @@ -64,6 +65,21 @@ 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;
> +
> + last_slash = dso->long_name + dso->long_name_len;
> + while (last_slash != dso->long_name && *last_slash != '/')
> + last_slash--;
> +
> + snprintf(file, MIN(size, strlen(symbol_conf.symfs) +
> + (last_slash - dso->long_name) + 2), "%s%s",
> + symbol_conf.symfs, dso->long_name);
> + snprintf(file + strlen(file), size-strlen(file), ".debug%s",
> + last_slash);
So the way such multi-snprintf() sequences are implemented in the kernel
is not this unreadable, fragile, repetitive concatenation of length
calculations, but an adjustment of 'size':
size -= snprintf(..., size, ...);
that way 'size' always tracks the remaining limit of the output string,
each snprintf consumes from it.
> + }
> + break;
Small nit: we generally put the final break inside the block.
Besides the details it looks like a useful patch.
Thanks,
Ingo
next prev parent reply other threads:[~2013-09-18 9:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 8:43 [PATCH] perf: Support for Openembedded/Yocto -dbg packages Ricardo Ribalda Delgado
2013-09-18 9:24 ` Ingo Molnar [this message]
2013-09-18 9:47 ` Ricardo Ribalda Delgado
2013-09-18 10:02 ` Ricardo Ribalda Delgado
2013-09-18 10:18 ` Peter Zijlstra
2013-09-18 13:07 ` Arnaldo Carvalho de Melo
2013-09-18 13:29 ` Ingo Molnar
2013-09-18 13:58 ` Ricardo Ribalda Delgado
2013-09-18 14:08 ` Arnaldo Carvalho de Melo
2013-10-02 0:54 ` Namhyung Kim
2013-10-02 6:13 ` 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=20130918092444.GA2778@gmail.com \
--to=mingo@kernel.org \
--cc=Waiman.Long@hp.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=ricardo.ribalda@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).