Re: [PATCH 2/3] perf symbol: Implement a very simple ELF symbol parser

From: Namhyung Kim
Date: Sun Nov 16 2014 - 21:31:18 EST


On Mon, 10 Nov 2014 09:09:04 -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Nov 10, 2014 at 03:36:48PM +0900, Namhyung Kim escreveu:
>> Hi Arnaldo,
>>
>> On Fri, 7 Nov 2014 12:26:18 -0300, Arnaldo Carvalho de Melo wrote:
>> > Em Fri, Nov 07, 2014 at 02:20:05PM +0900, Namhyung Kim escreveu:
>> >> It'll be used to show (userspace) symbol names when libelf isn't (or
>> >> cannot be) linked.
>> >
>> > Does this deals with prelink, etc?
>>
>> I believe so. :)
>>
>> >
>> >> # Overhead Command Shared Object Symbol
>> >> # ........ .......... ................. .........................
>> >> #
>> >> 37.01% mem-memcpy libc-2.17.so [.] __memcpy_ssse3_back
>>
>> namhyung@sejong:linux$ readelf -WS /lib64/libc-2.17.so | grep prelink
>> [41] .gnu.prelink_undo PROGBITS 0000000000000000 200368 000c30 01 0 0 8
>>
>> namhyung@sejong:linux$ nm /lib64/libc-2.17.so | grep __memcpy_ssse3_back
>> 0000003153f46f40 t __memcpy_ssse3_back
>
> Right, in this case most of the samples seems to map to what is expected
> for that workload, and the binary was prelinked. Good.
>
> What about binaries that are not prelinked? IIRC there is code in the
> full blown ELF symbol-elf.c file to detect that and act accordingly,
> from a _very_ quick look I didn't saw it in this minimalistic ELF symtab
> reader, hence my question.

AFAIK we deal with prelink'ed binary and normal binary as same way - we
only cares about the file offsets.


$ perf top --stdio
PerfTop: 110 irqs/sec kernel:70.0% exact: 0.0% [4000Hz cycles], (all, 12 CPUs)
--------------------------------------------------------------------------------------------
9.42% perf [.] map__process_kallsym_symbol
8.91% [kernel] [k] kallsyms_expand_symbol.constprop.1
6.80% [kernel] [k] memcpy
6.08% [kernel] [k] vsnprintf
...


Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/