[LLVMdev] Adding sample profile support to llvm-profdata?

Diego Novillo dnovillo at google.com
Fri Oct 24 13:16:25 PDT 2014

Duncan, Justin,

I'm about to submit a series of patches that add writing capabilities for
sample profiles in both text and binary formats. Soon, I'll add a third
format (to make it interoperable with GCC).

I would like to add some profile maintenance utilities as well: merging,
dumping and converting.

It seems like the best place would be tools/llvm-profdata. But that means
that I need to have a way of distinguishing sample from instrumented

For the binary formats, it's easy to have the tool check the magic bits at
the start, but for the text format it is not easy to tell whether we're
dealing with a sample profile vs an instrumented profile.

The options I see are:

1- Add a --profile-type={sample|instr} to llvm-profdata to specify whether
we are dealing with a sample or an instrumented profile. This would help
prevent mixing and matching the two types of profiles (they are not
convertible one to the other, not easily anyway).

2- Write a totally separate tool to deal with sample profiles.

I am slightly in favour of option #1. I could even make
--profile-type=instr to avoid having a flag day for tools you may have

Thanks. Diego.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141024/64cc8e73/attachment.html>

More information about the llvm-dev mailing list