[PATCH] Linux Perf to LLVM converter [1/5] - API

Diego Novillo dnovillo at google.com
Mon Aug 11 12:03:52 PDT 2014


I've created a phabricator patch to simplify updates to the patch. The
only problem is that I couldn't find a way of making phabricator take
the split patches.  I would've been able to generate the initial split
in different phab patches, but updates would've been painful (it
would've forced me to update the patches manually).

http://reviews.llvm.org/D4850

The only difference in the phab patch is that the code now builds with
both cmake and autoconf/make.


Thanks. Diego.


On Thu, Jul 31, 2014 at 11:41 AM, Diego Novillo <dnovillo at google.com> wrote:
> This is the first in a series of 5 patches that port the Linux
> Perf converter from https://github.com/google/autofdo to LLVM.
>
> The patches are not yet ready to commit, but they are
> significant, so I would like to start the review process early.
> In this initial round, I am interested in getting an initial
> version that is not too different from the original sources on
> github.
>
> I'll describe each patch in detail on their own postings. Here's
> an overview:
>
> 1. API: This patch introduces two classes (SampleProfileConverter,
>    and SampleReader) which need to be specialized for each
>    particular sample profiler we want to convert from.
>
> 2. Perf converter. This implements the functionality needed to
>    read and convert samples from Linux Perf.
>
> 3. Perf reader. This library reads and parses sample data emitted
>    by Linux Perf.
>
> 4. ELF reader and symbolizer. This will not survive here long. My
>    immediate plan is to replace it with existing LLVM
>    functionality.
>
> 5. New 'convert' command to tools/llvm-profdata. This exposes the
>    converter to the existing profile manipulation tool.
>
> Things still missing:
>
> - Test cases. I will add them with the initial commit.
>
> - Conversion of logging and output code. This still uses the
>   Google conventions. In order to simplify my future maintenance,
>   I would like to have an initial version that is not too far
>   apart from the original github sources. I will change these in
>   subsequent patches.
>
> - The code builds with cmake/ninja, but I haven't tested it with
>   autoconf/make. I understand I may need to change file name
>   extensions from .cc to .cpp to do that.
>
> Out of all this code, I'm willing to become upstream for the
> high-level Perf conversion functionality, the LLVM profile writer
> and the API.
>
> However, I would like to remain downstream for the actual Linux
> Perf parsing bits (patch #3: everything under the quipper/
> directory). I have trimmed this code as much as I could (the
> upstream version on github has more functionality that we don't
> need), but the Perf format is bound to change.
>
> I would like to be able to port patches from the github repo into
> the LLVM tree from time to time. If I have to alter the existing
> code too much, it will be hard to do.
>
> I am not worried about the ELF reader (patch #4: everything under
> the symbolize/ directory). This is functionality that largely
> already exists in LLVM. What doesn't exist, I can move into the
> existing LLVM support.
>
> Another thing I'm going to work incrementally is separating the
> Perf-specific code out of the PerfConverter/ directory. As we add
> converters for other sample profilers, we'll want to improve the
> API to facilitate adding new profilers.
>
> Since we only have one instance now, it's not clear what other
> functionality we will need to expose. I prefer to evolve that as
> needed, so we don't end up over-engineering it.
>
> Although I've split the contribution in 5 patches, I will submit
> them in a single commit once I get final approval.
>
>
> Thanks. Diego.



More information about the llvm-commits mailing list