Re: [RFC 00/79] perf tools: Initial libperf separation

From: Jiri Olsa
Date: Wed Jul 24 2019 - 04:53:37 EST


On Mon, Jul 22, 2019 at 09:23:36AM -0700, Ian Rogers wrote:
> This is really helpful and thank you for taking the initiative! I've
> no real feedback other than to offer support.
> We've been looking in this direction to avoid memory overhead in:
> https://github.com/google/perf_data_converter
> Some use cases:
> 1) streaming protobuf rather than perf.data files,

hum, we already have the CTF conversion support (perf data convert --to-ctf),
perhaps we could add support for profile.proto, so you dont need special app

> 2) using libperf inside of a runtime with JIT for a symbolization
> story that can reduce the storage/memory overhead of the current 'perf
> record' and 'perf inject -j'. Something similar is done here:
> https://github.com/jvm-profiling-tools/async-profiler/blob/936a9fea8dafc5d0674860d229a1b3d86d295e2f/src/perfEvents_linux.cpp

I think that once we have the mmap interface in place we can
discuss some higher level interface that would help you

> 3) self profiling with dwarf based call graphs, to avoid stack samples
> being visible outside of the process which could be a security
> concern.

same as above, once we have mmap support I think this is
one of the things we definitely want to add to libperf

>
> Most of our tooling is C++ rather than C, and we run into issues like
> tools/include/linux/list.h using 'new' as a variable name. The

libperf has currently the full object separation, so outside users
dont see its object struct's inners.. that should solve the 'new' issue

> duplication of header files in tools/, the importance of -I precedence
> and the use of -include have been other build system gotchas -
> principally because there are so many files with exactly the same
> name. I don't know if in the reorganization into a library this can be
> simplified.

libperf will be public so the building should be hopefuly simpler
and straightforward

thanks a lot for the feedback,
jirka