[llvm-dev] Profiling data structure

Roger Pau Monné via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 25 00:26:18 PDT 2017


Hello,

I've been working on implementing some basic functionality in order to
use the llvm profiling functionality inside of a kernel (the Xen
hypervisor). The only functionality I'm interested in is being able to
reset the counters, get the size of the data, and dump the data into a
memory buffer.

I have to admit I haven't been able to find a lot of documentation
about how this data is stored inside of the different sections, but
with the code in compiler_rt/libs/profile I've been able to craft
something that seems to do something sensible.

I have however a couple of questions:

 - The "Values" field in __llvm_profile_data always seems to be NULL.
   Is this expected? What/why could cause this?

 - The fields in the NumValueSites array inside of __llvm_profile_data
   also seem to always be 0.

 - Since what I'm coding is a decoupled replacement for the profiling
   runtime inside of compiler_rt, is there anyway that at compile or
   run time I can fetch the version of the profiling data?
   I'm mostly worried that at some point llvm will bump the version
   and change the layout, and then I will have to update my runtime
   accordingly, but without llvm reporting the version used by the
   compiler it's going to be very hard to keep backwards
   compatibility or to detect version bumps.

Thanks, Roger.


More information about the llvm-dev mailing list