No subject

Diego Novillo dnovillo at google.com
Thu Jul 31 08:32:46 PDT 2014


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sample-profile-converter-api.diff
Type: text/x-diff
Size: 6079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140731/3e8999da/attachment.diff>


More information about the llvm-commits mailing list